Hi Stuart

Here’s a refactored version that works:

\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">>

The changes include:

* Using an outer variable “state” to hold the name of the state tiddler so that 
we only compute it once
* Using the double underscore syntax to access the “tiddler” parameter in 
constructing the state tiddler title
* Switching to a block dropdown with a manually specified width
* Using 100% as the image width so that the height is automatically scaled in 
proportion

Best wishes

Jeremy

> On 7 Aug 2018, at 18:55, Mohammad <[email protected]> wrote:
> 
> Could you check it without class="tc-drop-down" and see what will be the 
> result?
> 
> On Tuesday, August 7, 2018 at 9:54:28 PM UTC+4:30, Stuart Amor wrote:
> Thank you guys, this has been a real education.  I have taken Jeremy's code 
> and have tried to expand it to create a button that when clicked brings up an 
> enlarged image, however the image in the popup is very narrow?
> 
> \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">>
> 
> 
> 
> On Tuesday, 7 August 2018 15:23:59 UTC+1, Jeremy Ruston wrote:
> I hadn't thought to think of the underscores as brackets, but that might be 
> useful. 
> 
> Best wishes
> 
> Jeremy
> 
> --
> Jeremy Ruston
> [email protected] <>
> https://jermolene.com <https://jermolene.com/>
> 
> On 7 Aug 2018, at 15:00, @TiddlyTweeter <[email protected] <>> wrote:
> 
>> Thank you Jeremy
>> 
>> Would it be OK to call __underscore brackets__ "sub-bracketing?"
>> 
>> What I mean is that it needs the "<" "<<" contexts to function, so its a 
>> subsidiary construct?
>> 
>> Best wishes
>> Josiah
>> 
>> On Tuesday, 7 August 2018 15:24:57 UTC+2, Jeremy Ruston wrote:
>>> 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? 
>> 
>> Yes, a construction involving either << or < is needed to use any variable.
>> 
>> The parameter name wrapped in double underscores is a valid variable name in 
>> its own right. When used in a filter it wouldn't have the double angle 
>> brackets:
>> 
>> <<link-links "[tag<__tagname__>!sort[modified]]">>
>> 
>> To put it another way: macro parameters are made available within the body 
>> of a macro as variables named with the parameter name wrapped in double 
>> underscores.
>> 
>> Best wishes
>> 
>> Jeremy.
>> 
>>> 
>>> 
>>> Jeremy Ruston wrote:
>>> The feature was new in 5.1.16:
>>> 
>>>  https://tiddlywiki.com/#Macro%20Definitions%20in%20WikiText 
>>> <https://tiddlywiki.com/#Macro%20Definitions%20in%20WikiText>
>>>> 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 [email protected] <>.
>>> To post to this group, send email to [email protected] <>.
>>> Visit this group at https://groups.google.com/group/tiddlywiki 
>>> <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
>>>  
>>> <https://groups.google.com/d/msgid/tiddlywiki/626580ce-0c7b-4520-a4b6-51f8f15a3844%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> <https://groups.google.com/d/optout>.
>> 
>> 
>> -- 
>> 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 [email protected] <>.
>> To post to this group, send email to [email protected] <>.
>> Visit this group at https://groups.google.com/group/tiddlywiki 
>> <https://groups.google.com/group/tiddlywiki>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tiddlywiki/7528980c-c6de-4f98-8c9f-86afaa47379d%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tiddlywiki/7528980c-c6de-4f98-8c9f-86afaa47379d%40googlegroups.com?utm_medium=email&utm_source=footer>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> 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 [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywiki 
> <https://groups.google.com/group/tiddlywiki>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/2fac4c0b-36c5-42a3-93a5-8559d651b065%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/2fac4c0b-36c5-42a3-93a5-8559d651b065%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/A05B7DC7-A437-45C9-B001-BC8B4117848E%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to