Prettifying list

147 views
Skip to first unread message

Magnus

unread,
Feb 25, 2019, 8:54:31 PM2/25/19
to TiddlyWiki
I have a template with 

<$list filter="[all[current]tag[Content]]">
 | <$list filter="[tag[Content]!has[draft.of]]"><$link to={{!!title}}><$view field="caption"/></$link> | </$list>
</$list>

showing a nice list in the footer of tiddler with tag "Content". But I think it would be even nicer if the currentTiddler will not be a link, just view. Example, in tiddler "Story" there will be links to all other tiddler tagged "Content" but the link to "Story" will not be a link, just view of caption-field but in the same place in all tiddler. Does this make any sense at all?

/Magnus

Mohammad

unread,
Feb 26, 2019, 6:01:46 AM2/26/19
to TiddlyWiki
Magnus,

 I would recommend to have this minor modification to your code. This will take care of those tiddler has no caption!


<$list filter="[all[current]tag[Content]]">
 | <$list filter="[tag[Content]!has[draft.of]]"><$link to={{!!title}}><$view field="caption"><$view field="title"></$view></$view></$link> | </$list>
</$list>

S. S.

unread,
Feb 26, 2019, 6:54:19 AM2/26/19
to TiddlyWiki
Below is one way to do it. Keeping the links in proper order on all the tiddlers will take more thought.

Tiddler
title: Any title you want
tag: $:/tags/ViewTemplate
\define title() <$view field="title"/>
\define caption()
   
<$set name="tv-wikilinks" value="no">
   
<$set name="display" tiddler=<<currentTiddler>> field="caption" emptyValue=<<title>>>
     
<<display>>
   
</$set>
   </
$set>
\end
\define my-template()
<$list filter="[all[current]tag[Content]]">| $(caption)$ </$list>

<$list filter="[all[current]tag[Content]]">
 | <$list filter="[tag[Content]!has[draft.of]] -[<currentTiddler>]"><$link to={{!!title}}>$(caption)$</$link> | </$list>
</
$list>
\end
<<my-template>>

The <<caption>> macro comes from here.
It ensures that there is still a link displayed in case a tiddler's caption field is empty.
The first <$list> widget displays the non-linked title/caption of the current tiddler
The third <$list> widget removes the title of the current tiddler from the list generated.

Hope this works for you.

Cheers!

Magnus

unread,
Mar 2, 2019, 5:38:08 PM3/2/19
to TiddlyWiki
Thank you :) That did the trick 
Reply all
Reply to author
Forward
0 new messages