\define caption(tiddler) {{$tiddler$!!caption}}
\define image(tiddler)[img width=80 ["<$macrocall $name="caption" tiddler=$tiddler$/>"|$tiddler$]]\end
<<image "test.jpg">>
\define image-inner() [img width=80 [$(caption)$|$(tiddler)$]]
\define image(tiddler)
<$vars caption={{$tiddler$!!caption}} tiddler='$tiddler$' >
<<image-inner>>
</$vars>
\end
On 7 Aug 2018, at 11:39, Mat <matia...@gmail.com> wrote:--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7dbce485-1bc9-4db2-bb7f-a6f1a5f54d82%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<<__tiddler__>>
<<$tiddler$>>
On 7 Aug 2018, at 12:26, Mat <matia...@gmail.com> wrote:
Your code does work but what on earth is this??????That is just totally new to me. What is it called? Are there any docs on it? Actually, what does it do? I wouldn't blink if it said
Parameters as Variables
The parameters to a wikitext macro are also available as special variables named as the parameter name wrapped in double underscores. For example, the example above could also be expressed as:
\define sayhi(name:"Bugs Bunny") Hi, I'm <$text text=<<__name__>>/>.
Accessing parameters as variables only works in macros that are wikified and not, for example, when a macro is used as an attribute value. The advantage of the technique is that it avoids the parameter value being substituted into the macro as a literal string, which in turn can help avoid issues with parameters that contain quotes.
... I wouldn't blink if it said
<<$tiddler$>>
The one thing that I'd like to know is whether, in all contexts, you need __underscore brackets__ to be "bracketed", i.e. does this construct always have to have "<<" or "<" etc. around it?
Jeremy Ruston wrote:The feature was new in 5.1.16:Parameters as Variables
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/626580ce-0c7b-4520-a4b6-51f8f15a3844%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7528980c-c6de-4f98-8c9f-86afaa47379d%40googlegroups.com.
\define image(tiddler)
<$button class="tc-btn-invisible tc-thumbnail-image" popup="$:/popupstatus/$tiddler$">
<$tiddler tiddler=<<__tiddler__>>> <$image source={{!!title}} width=80 tooltip={{!!caption}}/> </$tiddler>
</$button>
<$reveal type="popup" state="$:/popupstatus/$tiddler$"><div class="tc-drop-down"> <$tiddler tiddler=<<__tiddler__>>> Bigger Picture <$image source={{!!title}} width=800 height=700 tooltip={{!!caption}}/>
</$tiddler>\end
<<image "Motovun Jack.jpg">>
\define image(tiddler)<$set name="state" value={{{ [<__tiddler__>addprefix[$:/popupstatus/]] }}}><$button class="tc-btn-invisible tc-thumbnail-image" popup=<<state>>>
<$tiddler tiddler=<<__tiddler__>>><$image source={{!!title}} width=80 tooltip={{!!caption}}/></$tiddler></$button>
<$reveal type="popup" state=<<state>>><div class="tc-block-dropdown-wrapper"><div class="tc-block-dropdown" style="width:400px;"><$tiddler tiddler=<<__tiddler__>>><$image source={{!!title}} width= 100% tooltip={{!!caption}}/></$tiddler></div></div></$set>\end<<image "Motovun Jack.jpg">>
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/2fac4c0b-36c5-42a3-93a5-8559d651b065%40googlegroups.com.