For example, I have 3 tiddlers tagged “document”: Tiddler A, Tiddler B and Tiddler C.
I would like the following to appear in the pill-tag next to the tag name (document):
for Tiddler A: document 1/3
for Tiddler B: document 2/3
for Tiddler C: document 3/3
(the first number is the position in the list field, the second the total number of tiddlers with that tag)
I edited the $:/core/macros/tag tiddler
, specifically the “tag-pill-inner” macro like this:
\define tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
\whitespace trim
<$vars
foregroundColor=<<contrastcolour target:"""$colour$""" fallbackTarget:"""$fallbackTarget$""" colourA:"""$colourA$""" colourB:"""$colourB$""">>
backgroundColor=<<__colour__>>
>
<$element-tag$
$element-attributes$
class="tc-tag-label tc-btn-invisible"
style=<<tag-pill-styles>>
>
<<__actions__>>
<$transclude tiddler=<<__icon__>>/>
<$view tiddler=<<__tag__>> field="title" format="text" />
<$set name="TiddlerTagged" value={{!!title}}>
<$list filter="[enlist{!!list}] :else[tag{!!title}sort[title]] +[allbefore<TiddlerTagged>count[]add[1]]" variable=Result><<Result>></$list>
/<$count filter="[tag<currentTiddler>]" />
</$set>
</$element-tag$>
\end
More specifically, my changes are theese:
<$set name="TiddlerTagged" value={{!!title}}>
<$list filter="[enlist{!!list}] :else[tag{!!title}sort[title]] +[allbefore<TiddlerTagged>count[]add[1]]" variable=Result><<Result>></$list>
/
<$count filter="[tag<currentTiddler>]" />
</$set>
I have, however, encountered a couple of difficulties:
- The first number (e.g.
1
/3) is always “1”, I must have done something wrong here:
<$set name="TiddlerTagged" value={{!!title}}>
<$list filter="[enlist{!!list}] :else[tag{!!title}sort[title]] +[allbefore<TiddlerTagged>count[]add[1]]" variable=Result><<Result>></$list>...</$set>
- The second number (e.g. 1/
3
) works fine, but does not count the shadow tiddlers that are part of the core, and I don’t know why…
<$count filter="[tag<currentTiddler>]" />