<$list filter="[my[filter]]"><$tiddler><$transclude /></$tiddler></$list><$list filter="[my[filter]]"><$tiddler tiddler=<<currentTiddler>> ><$transclude /></$tiddler></$list>
<$list filter="[my[filter]]"><$transclude tiddler=<<currentTiddler>> /></$list>
Rather than resorting to macros, I'm know I can invoke those buttons with template transclusion (e.g, {{||MyButton}}).
But how can I use template transclusion within the <$list> macro?
This doesn't seem to work:Nor does this:<$list filter="[my[filter]]"><$tiddler><$transclude /></$tiddler></$list>Nor this:<$list filter="[my[filter]]"><$tiddler tiddler=<<currentTiddler>> ><$transclude /></$tiddler></$list><$list filter="[my[filter]]"><$transclude tiddler=<<currentTiddler>> /></$list>
\define trans() {{||$(x)$}}
<$list filter="[my[filter]]" variable="x"><<trans>></$list>
<$list filter="...">
{{||template}}
</$list>
Or then...
<$list filter="..." template="template title"/>
?
Best wishes, Tobias.
What's wrong with using either of:<$list filter="...">
{{||template}}
</$list>Or then...
<$list filter="..." template="template title"/>
The $list widget is being used to get the names of the buttons to transclude into the currentTiddler context. However, when the $list widget is processed, the currentTiddler *within* the widget content is a "button tiddler", not the tiddler in which the $list is embedded. To achieve the proper results, we need to keep the currentTiddler context unchanged within the $list, and use a different list variable to get the *template* name used to construct the {{||template}} transclusion syntax.
<$list filter="[get[those_buttons]]" variable="button">
<$transclude tiddler=<<button>/>
</$list><$transclude tiddler=<<currentTiddler>> template=<<button>>Have you tried:\define trans() {{||$(x)$}}
<$list filter="[my[filter]]" variable="x"><<trans>></$list>* using variable="x" prevents the $list widget from changing the current tiddler context.* the trans() macro assembles the transclusion syntax using the current value of "x"
Note: I thought that the <$transclude> widget had params for both tiddler="..." and template="...", so that template transclusion using variable params could be done without needing a macro to assemble the {{tiddler||template}} syntax... but it doesn't seem to be the case.
<$tiddler tiddler=<<currentTiddler>> ><$transclude tiddler="MyButton" /></$tiddler>title: Bar
foo: no
{{!!foo}}
title: Foo
foo: yes
<$transclude tiddler="Bar"/><$list filter="[get[those_buttons]]" variable="button">
<$transclude tiddler=<<button>/>
</$list>
<$list filter="[get[those_buttons]]" variable="button">
<$transclude tiddler=<<button>/>
</$list>
By the way Scott,Pplease pay attention to the terms (perhaps revisit the docs)<$list> and <$setvars/> are widgets, not macros. :-)
When the concepts are confusing, I'm trying to remember to look to the syntax as a kind of cheat sheet, also:
- If its longhand form is <$something ... />, it's a widget.
- If its longhand form is <$macrocall $name="something" ... />, it's a macro.
- If it can be written in the shorthand <<something ...>>, it's a macro.