On Sunday, August 9, 2020 at 5:04:13 AM UTC-7, Bob Flandard wrote:
>
> I'm trying and failing to write a filter expression that lists all 
> tiddlers that are tagged "some name" (call this list of tiddlers resultA) 
> and then extend that list to include all tiddlers that are tagged with the 
> names in resultA. For the general case this would continue recursively 
> until no new tiddlers were added to the list.
>

I did exactly this function as part of the InsideTW "page navigation" 
interface.

It does a recursive "walk" of a "tag tree", and generates a flat list of 
tiddler titles:

\define toc-list(here,max,exclude,level:"1")
<$list filter="""[tag[$here$]] $exclude$ -[[$here$]]""">
   <$link /><br>
   <$reveal default="$level$" type="nomatch" text="$max$">
      <$macrocall $name="toc-list" here=<<currentTiddler>> max="$max$" 
exclude="""$exclude$ -[[$here$]]""" level={{{ [[$level$]add[1]] }}}/>
   </$reveal>
</$list>
\end

Invoke it like this:
<<toc-list "some name">>
where "some name" is the top-level tag for your tree.

Notes:
1) There is also an optional "max" parameter to limit the depth of traversal
2) The "exclude" and "level" parameters are only for internal use by the 
macro itself
3) The default output just lists each title, one per line.  If you want a 
bullet list, you could change this line:
<$link /><br>
to this:
<li><$link /></li>
and if you want a numbered list, also wrap the macro invocation within 
<ol>...</ol>, like this:
<ol><<toc-list "some name">></ol>

enjoy,
-e 

-- 
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/4e2b570d-da5d-4739-a3a6-3d7d8d821feeo%40googlegroups.com.

Reply via email to