Thanks Eric for the non-obvious solution.

For completeness I tried to use element-tag="$link" hoping that I would get 
the tag-pill graphic but the functionality of a link. However it looked 
like a link.

Also thanks for the trick about partial overriding core macros. I have some 
customization to have a dropdown to choose tags for some other field that 
only authors have in my wiki and I copy-paste-modified the whole thing.

On Wednesday, 7 July 2021 at 05:35:20 UTC+2 TW Tones wrote:

> Thanks so much Eric,
>
> Just what I wanted to know. I assume as long as my tag pill inner is lower 
> on the list of items tagged $:./tags/Macro then it will override the core?
>
> Such core macro overrides would be a useful thing, perhaps however we need 
> a mechanism to indicate when this is occurring?
>
> Here I use the variable tag-label and default to the tag name
> <$text text={{{ [[$(tag-label)$]!is[blank]] ~[[$tag$]] }}}/>
>
> calling tags as follows
> <$vars tag-label="argle bargle"><<tag>></$vars> 
>
> Thanks again, this is a tip I expect to use elsewhere
> Tones
>
> On Wednesday, 7 July 2021 at 11:35:24 UTC+10 Eric Shulman wrote:
>
>> 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/99a19a25-e3d9-403a-987e-c414544a7633n%40googlegroups.com.

Reply via email to