Transclude widget set para "tiddler" by macro not worked, how to solve it?

\define tmpTWCrossLinksConcat()
{{$(tidName)$!!icon}}
\end

\define tmpTWCrossLinksConcat1()
{{TestGo!!icon}}
\end

<$set name="tidName" value="TestGo">
<<tmpTWCrossLinksConcat>>
// not work below
<$transclude tiddler=<<tmpTWCrossLinksConcat>>/>  
// not work below
<$transclude tiddler=<<tmpTWCrossLinksConcat1>>/>  
// work below
<$transclude tiddler={{TestGo!!icon}}/>
</$set>

You can check my code, it is a limitation of tiddlywiki or I make something wrong?

See if this helps. I modified the HelloThere tiddler at TW .com by adding a field test with the value `tw’.

The transclude widget wants a tiddler AND/OR a field. You were setting the tiddler param to a transclusion.

you can use the text widget to see what is returned from the macro -

What is happening is that a tiddlerwith litteral title “{{TestGo!!icon}}” is being transclude ie.

But I want to get image of icon not just text. you can check this post for the context if you need

But notice that @EricShulman is addressing the tiddler and the field separately, just as the $transclude widget requires. Your code was trying to transclude the value of a transclusion {{…}} which did not resolve to a tiddler. Going back to my example, the value is “tw”. That is NOT a tiddler, it’s just a string. In your example, it’s not a tiddler, it’s just an an icon.

<$transclude tiddler="This must be a tiddler" field="optional field defaults to text" />

Keep this in mind:

There are essentially the same:


{{!!text}}

<$transclude />

<$transclude tiddler=<<currentTiddler>>/>

<$transclude tiddler=<<currentTiddler>> field="text" />

I know that. Back to the first post.

\define tmpTWCrossLinksConcat()
{{$(tidName)$!!icon}}
\end

\define tmpTWCrossLinksConcat1()
{{TestGo!!icon}}
\end

<$set name="tidName" value="TestGo">
// the macro below show content correct 
<<tmpTWCrossLinksConcat>>

// not work below
<$transclude tiddler=<<tmpTWCrossLinksConcat>>/>  
// not work below
<$transclude tiddler=<<tmpTWCrossLinksConcat1>>/>  
// work below
<$transclude tiddler={{TestGo!!icon}}/>
</$set>

You can see <$transclude tiddler={{TestGo!!icon}}/> this worked. I have a tid same with the value of TestGo’s icon field.

But if I use a macro to replace the {{TestGo!!icon}} part. The transclude failed I want to know why.

That is the same as writing the following and therefore the transclusion is not processed:
<$transclude tiddler="{{TestGo!!icon}}"/>

When you assign a variable to a widget attribute, it is assigned as that literal string after substitution of any variables or parameters. It is never wikified and therefore the text reference is never processed.

@saqimtiaz explained it well. The same point is emphasized by warnings at the bottom of https://tiddlywiki.com/#HTML%20in%20WikiText (new to the docs about 6 weeks ago).

Text retrieved for dynamic attribute values is not wikified.

Any workaround for this? If I get a name for other tid, and want to transclude its icon?

Have you tried something like…

<$transclude tiddler={{{ [<tidName>] }}} field=icon />
1 Like

<$transclude tiddler={{{ [<tidName>get[icon]] }}} />

1 Like