Haha, good point, I'm overcomplicating things too. :-)

On Tuesday, November 24, 2020 at 3:29:32 PM UTC-6 Eric Shulman wrote:

> On Tuesday, November 24, 2020 at 11:37:52 AM UTC-8 soren.b...@gmail.com 
> wrote:
>
>> Have you tried the image widget <https://tiddlywiki.com#ImageWidget>? 
>> You might be making this a lot more complicated than necessary...from the 
>> letter of what you wrote all you need to do is write this in tiddler B:
>>
>> <$image source={{A!!structure_file}}>
>>
>> In other words, you're transcluding the value of the structure_file field 
>> of A as the value of the source image widget.
>>
>> Now if you need the tiddler A to be dynamic, rather than hard-coding it 
>> in the wiki text, you'll have to get a bit more complicated. You might be 
>> tempted to try this:
>>
>> \define makeTransclusion() {{$(myTiddler)$!!structure_file}}
>> <$set name="myTiddler" value="A">  <!-- or however A gets determined -->
>>     <$image source=<<makeTransclusion>>>
>> </$set>
>>
>> But if you try that, you'll see the image link is broken. If you use your 
>> browser's developer tools to inspect the image, you'll see it links 
>> literally to "{{A!!structure_file}}".
>>
>
> The reason the image is broken is because after the constructed widget 
> parameter is "returned" by the macro, it is not parsed a *second* time to 
> evaluate the transclusion.
> However, if you place the entire $image widget inside the macro, you can 
> forego the use of $wikify, like this:
>
> \define showStructure(tid) <$image source={{$tid$!!structure_file}} />
> <<showStructure "A">>
>
> -e
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/c0b48349-572b-446a-a884-aa8eb085025bn%40googlegroups.com.

Reply via email to