This replaces the tag macro with something that is backwards compatible so
it won't break anything, but if you give a second input to the tag macro it
will display that instead of the tag title.
So <<tag foo bar>> will display a tag pill that says 'bar' but otherwise it
will act like the tag pill for foo. It is backwards compatible so it
doesn't break anything in how tags normally act. It is a bit hacky for the
moment since we don't have a good way to test for an empty variable.
Put this into a tiddler tagged with $:/tags/Macro (or replace the contents
of $:/core/macros/tag with this):
\define tag-pill-styles()
background-color:$(backgroundColor)$;
fill:$(foregroundColor)$;
color:$(foregroundColor)$;
\end
\define
tag-pill-inner(tag,icon,colour,fallbackTarget,colourA,colourB,element-tag,element-attributes,actions)
<$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$"""/> <$list
filter='[{$:/core/macros/tag!!someemptyfield2}!prefix<LABEL>]'
emptyMessage='<$view tiddler="""$tag$""" field="title" format="text" />'
variable='dummy'><<LABEL>></$list>
</$element-tag$>
</$vars>
\end
\define
tag-pill-body(tag,icon,colour,palette,element-tag,element-attributes,actions)
<$macrocall $name="tag-pill-inner" tag="""$tag$""" icon="""$icon$"""
colour="""$colour$""" fallbackTarget={{$palette$##tag-background}}
colourA={{$palette$##foreground}} colourB={{$palette$##background}}
element-tag="""$element-tag$"""
element-attributes="""$element-attributes$""" actions="""$actions$"""/>
\end
\define tag-pill(tag,element-tag:"span",element-attributes:"",actions:"")
<span class="tc-tag-list-item">
<$macrocall $name="tag-pill-body" tag="""$tag$""" icon={{$tag$!!icon}}
colour={{$tag$!!color}} palette={{$:/palette}}
element-tag="""$element-tag$"""
element-attributes="""$element-attributes$""" actions="""$actions$"""/>
</span>
\end
\define tagLabel(tag label)
<$set name=LABEL value="""$label$""">
{{$tag$||$:/core/ui/TagTemplate}}
</$set>
\end
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/92ff4789-7ff6-4443-aab1-f818c021e345%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.