On Tuesday, November 24, 2020 at 11:37:52 AM UTC-8 [email protected] 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/0208b864-27c6-4aa8-8c3e-31304e048237n%40googlegroups.com.

Reply via email to