Syntax Question - How to include fields in a ToC

54 views
Skip to first unread message

Pieter-Michiel Geuze

unread,
Oct 5, 2020, 8:29:16 AM10/5/20
to TiddlyWiki
Friends,

I apologize for needing your time and assistance again.

I am trying to include this code as the beginning of some of my tiddlers. I want to use the {{!!title}} instead of TITLE so that the code is the same and does not require me to manually input the tiddler title for each instance.

!![[TITLE]]
<<tabs "[tag[TITLE]!title[TITLE]!sort[modified]]" "[[TITLE]]" "$:/state/popup/tabs">>

I would be happier if I could make this a tiddler and then use transclusion for each tiddler so I could change just this one tiddler and have transclusion pass through to all tiddlers.

How do I rewrite TITLE so it works as {{!!title}} for the current tiddler or the tiddler that it is transcluded in.

Thank as always.

Eric Shulman

unread,
Oct 5, 2020, 9:18:42 AM10/5/20
to TiddlyWiki
On Monday, October 5, 2020 at 5:29:16 AM UTC-7, Pieter-Michiel Geuze wrote:
I apologize for needing your time and assistance again.

No need to apologize.  The people in this group LOVE to help others be successful with Tiddlywiki!
 
I am trying to include this code as the beginning of some of my tiddlers. I want to use the {{!!title}} instead of TITLE so that the code is the same and does not require me to manually input the tiddler title for each instance.
!![[TITLE]]
<<tabs "[tag[TITLE]!title[TITLE]!sort[modified]]" "[[TITLE]]" "$:/state/popup/tabs">>

Try this: 
!! {{!!title}}
<$macrocall $name="tabs" tabslist="[tag{!!title}!title{!!title}!sort[modified]]" default={{!!title}} state="$:/state/popup/tabs"/>

Notes:
* {{!!title}} shows the title text of the current tiddler
* $macrocall name="tabs"... is used instead of <<tabs>> so we can pass a reference to the current title as the value of the "default" param
* note that *within the filter*, the {!!title} syntax uses only SINGLE curly braces, instead of the usual doubled curly braces
* however, the "default" param DOES use doubled curly braces since it is not a filter
 
I would be happier if I could make this a tiddler and then use transclusion for each tiddler so I could change just this one tiddler and have transclusion pass through to all tiddlers.

Normally, when you use transclusion, e.g., {{something}}, any field references in "something" (e.g., {{!!title}}) get their values from the "something" tiddler.  However, you want the field values to be from the tiddler that "something" is transcluded *into*.  To do this, add "||" in front of the tiddler name, like this: {{||something}}.  This basically says to show the content from "something", but use the fields from the current tiddler.

Let me know how it goes...
-e
Reply all
Reply to author
Forward
0 new messages