buid a tree

72 views
Skip to first unread message

Rustem

unread,
Apr 20, 2015, 10:34:31 PM4/20/15
to tiddl...@googlegroups.com

I have a macro that outputs a tree of tiddlers, but it only works when invoked from the “root node” tiddler. If I put it in a tiddler with a different name, there is no tree. Basically, the parameter is ignored, it just picks up the current tiddler’s title and goes from there.

I spent all day trying to make it work from any tiddler, to no avail. I looked at the “toc” macros, but wasn’t able to adapt them. I just need a simple tree. I cannot use one of the “toc” macros - unlike “toc”, mine doesn’t go into infinite recursion when a tiddler is tagged with itself.

Please help! Thanks!

\define tree_macro(node)
;[[$node$]]
:<$list filter="[<currentTiddler>tagging[]!<currentTiddler>]">

  <$macrocall $name=tree_macro node={{!!title}}/>

</$list>
\end

-R.

Eric Shulman

unread,
Apr 20, 2015, 11:35:53 PM4/20/15
to tiddl...@googlegroups.com
On Monday, April 20, 2015 at 7:34:31 PM UTC-7, Rustem wrote:

I have a macro that outputs a tree of tiddlers, but it only works when invoked from the “root node” tiddler. If I put it in a tiddler with a different name, there is no tree. Basically, the parameter is ignored, it just picks up the current tiddler’s title and goes from there.

Please help! Thanks!

\define tree_macro(node)
;[[$node$]]
:<$list filter="[<currentTiddler>tagging[]!<currentTiddler>]">

  <$macrocall $name=tree_macro node={{!!title}}/>

</$list>
\end
Use the <$tiddler> widget to set the context for the initial node, like this:

\define tree_macro(node)
<$tiddler tiddler="$node$">

;[[$node$]]
:<$list filter="[<currentTiddler>tagging[]!<currentTiddler>]">

 
<$macrocall $name=tree_macro node={{!!title}}/>

<
/$list>
</
$tiddler>
\end

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
Reply all
Reply to author
Forward
0 new messages