Let’s say I have two tags: $:/tag/type-1
and $:/tag/type-2
. A tiddler will have one or the other tag, but both tags. I would like to be able to define a class to a span based on the tag.
For example, see my code below:
<$list filter="[tag[$:/tag/type-1]]">
<span class="tc-tiddler-class class-type-1">
</$list>
<$list filter="[tag[$:/tag/type-2]]">
<span class="tc-tiddler-class class-type-2">
</$list>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</span>
The problem with using this approach is I get the output that looks like this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.</span>
Because the </span>
tag is not nested inside any of the <$list>
widgets, it appears as part of the output.
To avoid that problem, I end up writing my code like this:
<$list filter="[tag[$:/tag/type-1]]">
<span class="tc-tiddler-class class-type-1">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</span>
</$list>
<$list filter="[tag[$:/tag/type-2]]">
<span class="tc-tiddler-class class-type-2">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</span>
</$list>
Is there a more efficient way?