When you click on a tag displayed via the <<tag>>
macro, a popup is created to show the list of links to the tiddlers with that tag. This popup uses the $reveal
widget which is controlled by a “state” tiddler. The name of the state tiddler is generated by using the <<qualify>>
macro, which adds a “magic number” to the state tiddler title.
As described here:
“The qualify macro… returns a unique string that encodes its position within the widget tree, as identified by the stack of transcluded tiddlers that lead to that position… It is implemented using the transclusion
variable.”
Normally, the transclusion
variable is automatically set whenever you transclude a tiddler using {{TiddlerName}}
or {{!!fieldname}}
or <$transclude tiddler=.. />
.
Since you are using multiple instances of <<tag "TableOfContents">>
macro in the same tiddler, they all have the same value for the transclusion
variable. As a result, the $reveal
widgets all generate the same “magic number” for the <<qualify>>
value, and thus all the popup state tiddler titles are using the same name. The result is, as you have noted, that clicking on any tag displayed with the <<tag>>
macro causes the popup to be displayed for every tag with the same name.
Fortunately, there is a quick workaround that you can use to force each instance of the <<tag>>
macro to generate a unique <<qualify>>
value by surrounding each <<tag>>
instance with a <$let>
widget that manually sets the transclusion
variable, like this:
<$let transclusion="1"><<tag "TableOfContents">></$let>
<$let transclusion="2"><<tag "TableOfContents">></$let>
For your particular use case, in which you are producing a table of output where each row of the table is for a different tiddler, you can set the transclusion
variable to that row’s tiddler title, ensuring that any tags shown for that row have a unique popup state title. Something like this:
<$let target="doc">
<table>
<$list filter="[tag<target>]" variable="thistiddler">
<tr>
<td><$link to=<<thistiddler>>/></td>
<td>
<$list filter="[<thistiddler>get[tags]enlist-input[]] -[<target>]">
<$let transclusion=<<thistiddler>>><<tag>></$let>
</$list>
</td>
</tr>
</$list>
</table>
</$let>
enjoy,
-e