Using a variabvle to transclude tagged tiddlers - assistence please

65 views
Skip to first unread message

TonyM

unread,
Dec 29, 2019, 3:50:45 AM12/29/19
to TiddlyWiki
Folks,

In the following code I just can't get the list widget to display its contents, including "hi" and transclude all tiddlers tagged with transcludeTag or 
\define transcludeTag() {{{ [<currentTiddler>addprefix[$:/autotag/transclude/]] }}}
$:/autotag/transclude transcluding items tagged <<transcludeTag>><br>
<$wikify name=tagname text="{{{ [<transcludeTag>] }}}">
tagname = "<<tagname>>"<br>
<$list filter="[<tagname>tagging[]]" variable="transcludeTiddler">
   hi <<transcludeTiddler>> <$transclude tiddler=<<transcludeTiddler>> mode=block />
</$list>
</$wikify>

The tagname displays correctly but does not work in the filter also using "[tag<tagname>]" or [tag<transcludeTag>]"
If I place the literal name in the filter it works eg "[tag[$:/autotag/transclude/New Tiddler 7]]"

I thought I needed to use the wikify widget but no,

What do you think?

Thanks in advance
Tony

Xavier Cazin

unread,
Jan 5, 2020, 6:17:12 AM1/5/20
to tiddl...@googlegroups.com
Hi Tony,

You probably solved your issue since, but in case you didn't, I just wanted to state for the record that it was a perfect job for the subfilter operator:

\define transcludeTag() [<currentTiddler>addprefix[$:/autotag/transclude/]]

$:/autotag/transclude transcluding items tagged {{{ [subfilter<transcludeTag>] }}}<br/>
<$list filter="[subfilter<transcludeTag>tagging[]]" variable="transcludeTiddler">

   hi <<transcludeTiddler>> <$transclude tiddler=<<transcludeTiddler>> mode=block />
</$list>

Since subfilter role is to plug filter strings into other filters, the computation of the filter result is delayed until necessary, first to display it thanks to the {{{}}} construct, then to feed it to the list widget as part of its filter attribute.
However, this power may have a drawback if we are not cautious: since the computation of [<currentTiddler>] is delayed, let's say you didn't give an explicit variable name to the list widget, and rather wanted to rely on it to set currentTiddler and pass it to its content:

\define transcludeTag() [<currentTiddler>addprefix[$:/autotag/transclude/]]

$:/autotag/transclude transcluding items tagged {{{ [subfilter<transcludeTag>] }}}<br/>

(outside the list widget, ''<$text text="[subfilter<transcludeTag>]"/>'' gives {{{ [subfilter<transcludeTag>] }}})<br/>
<$list filter="[subfilter<transcludeTag>tagging[]]">
   hi <<currentTiddler>> <$transclude mode=block />
(inside the list widget, ''<$text text="[subfilter<transcludeTag>]"/>'' gives {{{ [subfilter<transcludeTag>] }}})
</$list>

Because the currentTiddler value changes when entering the list widget, so does the value of any included filters that contain a reference to currentTiddler.

Best,
-- Xavier Cazin


--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0ee38a64-297c-4d83-b809-68619d1fda17%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages