On Tuesday, July 6, 2021 at 4:35:25 PM UTC-7 TW Tones wrote:

> I wanted to have a label on a tag-pill, rather then the tag name yet have 
> the same tag drop down. Can you suggest a method? Ideally without modifying 
> the macro?
>

Changing the tag-pill output will, of necessity, require modifying the 
macro.  However, you can *define a local variant of the tag-pill-inner() 
macro code*, rather than changing the core definition.

My TiddlyTools TagCloud is an example of a modified tag macro:
  
 
http://tiddlytools.com/filtergenerators.html#TiddlyTools%2FFilterGenerators%2FTagCloud
In this code, I add a "tag count" to the tag-pill display.  I did this by 
first *copying the tag-pill-inner() definition from $:/core/macros/tag*, 
and then adding display of the $(count)$ variable, the value of which was 
set by my code, before invoking the <<tag>> macro entrypoint.  Here's my 
customized version of tag-pill-inner()

\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" /> *($(count)$)*
</$element-tag$>
</$vars>
\end

For your example -- using an alternative label instead of the tag name ---, 
you could do something similar, by *replacing* the part of tag-pill-inner() 
code that displays the icon and tag name, like this:
\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$*<$text text="""$(label)$"""/>*
</$element-tag$>
</$vars>
\end

Then, let's suppose you want to *show the tag's caption text as the 
label*...you 
would invoke the <<tag>> macro like this:
<$vars label={{!!caption}}><<tag>></$vars>

or, if you want to use some specific literal text:
<$vars label="argle bargle"><<tag>></$vars>

Note that the <<tag>> macro relies upon the value of <<currentTiddler>> to 
determine which tag is being rendered.

enjoy,
-e

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/80dc4a71-7371-4f8e-bf53-d56413f4c578n%40googlegroups.com.

Reply via email to