[TW5] How do I transclude text of tiddler generated by qualify macro into macrocall widget?

61 views
Skip to first unread message

CL

unread,
Jan 6, 2017, 7:05:45 PM1/6/17
to TiddlyWiki
Minial Test case:

\define minimalTestCase(var)
<$list filter="[tag[test]limit[$var$]]">
{{!!title}}
</$list>
\end

<$select tiddler=<<qualify "$:/state/this">> >
    <option>10</option>
    <option>20</option>
    <option>30</option>
</$select>

<$macrocall $name="minimalTestCase" var={{???}}/>

The purpose of this case is to transclude text of tiddler genereated by qualify macro.
I think I need another helper macro for the 'var' but I just can't figure it out.
I would really appreciate any help on this.

Best wishes.


Mark S.

unread,
Jan 6, 2017, 7:24:55 PM1/6/17
to TiddlyWiki

This seems to work:

\define minimalTestCase(var)
<$list filter="[tag[test]limit{$var$}]">
{{!!title}}
</$list>
\end

<$select tiddler=<<qualify "$:/
state/this
">> >

    <option>10</option>
    <option>20</option>
    <option>30</option>
</$select>

<$macrocall $name="minimalTestCase" var=<<qualify "$:/state/this">>/>

Have fun,
Mark

Tobias Beer

unread,
Jan 6, 2017, 7:35:36 PM1/6/17
to TiddlyWiki
Hi CL,

With a qualified state, always wrap the context in which you want to use it and never calculate it twice:

\define minimalTestCase(limit)
<$list filter="[tag[Filter Operators]sort[title]limit{$limit$}]">
<$link><$view field="title"/></$link><br>
</$list>
\end

<$vars state=<<qualify "$:/
state/this">>>

<$select tiddler=<<state>>>
    <option></option>

    <option>10</option>
    <option>20</option>
    <option>30</option>
</$select>

<$macrocall $name="minimalTestCase" limit=<<state>>/>

</$vars>


Best wishes,

Tobias.

CL

unread,
Jan 6, 2017, 10:30:04 PM1/6/17
to TiddlyWiki
Thank you so much Mark and Tobias!

It works perfectly.

Best wishes,
Reply all
Reply to author
Forward
0 new messages