[TW5] Show ToC-path in tiddler

94 views
Skip to first unread message

magev958

unread,
Aug 4, 2015, 6:48:47 AM8/4/15
to TiddlyWiki

Hi, I was wondering if it would be (easy) possible to show the path to a tiddler

If I have a ToC like this:

 
tiddler1

  tiddler1.1

    tiddler1.1.1

    tiddler1.1.2

tiddler2

  tiddler2.1

  tiddler2.2

 
In tiddler1.1.2 I'd like automagic something like:
 

tiddler1 / tiddler1.1 / tiddler1.1.2

 
in the top of the text-field
 
/Magnus

Eric Shulman

unread,
Aug 4, 2015, 9:48:28 AM8/4/15
to TiddlyWiki
On Tuesday, August 4, 2015 at 3:48:47 AM UTC-7, magev958 wrote:

Hi, I was wondering if it would be (easy) possible to show the path to a tiddler

If I have a ToC like this


Give this a try:

1) create a tiddler, [[TOCPath/Macro]], tagged with "$:/tags/Macro", containing:
\define TOCPath()
<$list filter="[all[current]tags[]![prefix[$:/tags]limit[1]]">
   
<<TOCPath>> <$view field="title"/>
</$list>
\end

2) create a tiddler, [[TOCPath/Template]], tagged with $:/tags/ViewTemplate", containing:
<<TOCPath>> <$view field="title"/>

3) add "list-before" field to [[TOCPath/Template]], with a value of:
$:/core/ui/ViewTemplate/body

Notes:
1) the filter excludes 'system tags' (e.g. starting with "$:/tags"), and assumes that the *first* tag on the tiddler is it's "parent" in the TOC tree.
2) the template invokes the macro for the current tiddler and includes the current tiddler title in the output (as requested)
3) the list-before field places the output before the body text (as requested)

enjoy,
-e
Eric Shulman
ELS Design Studios
TiddlyTools - "Small Tools for Big Ideas!"
InsideTiddlyWiki: The Missing Manuals

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:

magev958

unread,
Aug 4, 2015, 1:17:20 PM8/4/15
to TiddlyWiki
Thank you, it worked perfekt!
Reply all
Reply to author
Forward
0 new messages