I am listing several tiddlers under a tag (currentTag). The links shall be displayed as below
- Use title of tiddler by default
- If tiddler has caption use it instead of title
- If the currentTag has a format field, look into it and use the field specified there
- If there is a global setting, look into it and use the field specified there
Note i: The format field has priority over global setting
Note ii: If there is no format, no global setting, use caption, if no caption, use title
In brief the priority is as below!
[Format] / [gSetting] / [Caption] / [Title]
If a specified field is empty, then use [Caption] / [Title] priority.
The below code works. Test it on https://tiddlywiki.com. BUT I am looking for a simpler code.
\define currentTag() HelloThere
\define gSetting() $:/config/LinkTitle
<$list filter="[tag<currentTag>]">
<$link to={{!!title}} tooltip=<<currentTiddler>> >
<!--- dispField determines how to show the link title for an item: use specified field in HelloThere, or use global setting -->
<$let dispField= {{{ [<currentTag>get[format]]:else[<gSetting>get[text]] :and[limit[1]] :else[[caption]] }}}
tv-wikilinks="no" >
<$list filter="[<currentTiddler>get<dispField>trim[]!is[blank]] :filter[<dispField>!match[title]]" variable=null emptyMessage='<$view field="title"/>'>
<$transclude field=<<dispField>> />
</$list>
</$let>
</$link><br>
</$list>