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}}".

Instead, when you add in the macro, you have to use $wikify 
<https://tiddlywiki.com/#WikifyWidget>, because the macro is returning raw 
wikitext, and TiddlyWiki does not automatically parse wikitext when passing 
it directly to HTML/widget attributes -- only when displaying it in the 
tiddler.

\define makeTransclusion() {{$(myTiddler)$!!structure_file}}

<$set name="myTiddler" value="A">  <!-- or however A gets determined -->
  <$wikify name="reference" text=<<makeTransclusion>>>
    <$image source=<<reference>>>
  </$wikify>
</$set>

On Tuesday, November 24, 2020 at 10:37:15 AM UTC-6 Anthony wrote:

> All,
>
> I have got myself into a pickle and so confused that I can no longer see 
> the wood for the trees...
>
>    1. I have two tiddlers, A and B.
>    2. Tiddler A stores information in fields about an organic compound - 
>    one of the fields is called 'structure_file' and gives the relative 
>    location of an image file.
>    3. In tiddler B I wish to load the image for the compound in tiddler 
>    A, which I assume is some form of a transclusion {{A!!structure_file}}.
>    4. Eric has already warned me that I cannot mix different types of 
>    syntax, {{...}} with [[...]], so I've been attempting to create a macro 
>    along the lines of another conversation (
>    https://groups.google.com/g/tiddlywiki/c/bTLtqQn-1GA/m/9316shQnDAAJ).
>    5. I have failed.
>    6. I decided to stop when I received a scary red JavaScript recursion 
>    error...
>    
> I'm sure it's not difficult but I'm beaten.
>
> Many thanks for any advice,
>
> Anthony
>
>

-- 
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/717c07a3-7ff1-4ae8-b23f-634908e3cfe9n%40googlegroups.com.

Reply via email to