1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-28 16:23:15 +00:00
TiddlyWiki5/core/wiki/macros/tag.tid
Jermolene 28591965b1 Yet more refactoring of the tag macro vs template
This change re-instates the existing behaviour whereby omitting the
parameter to the “tag” macro will default to the current tiddler
2016-12-16 17:25:06 +00:00

31 lines
1.5 KiB
Plaintext

title: $:/core/macros/tag
tags: $:/tags/Macro
\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$"""/> <$view tiddler="""$tag$""" field="title" format="text" />
</$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 tag(tag)
{{$tag$||$:/core/ui/TagTemplate}}
\end