Discussion:
[tw] Re: [TW5] Tag Pill by another name?
(too old to reply)
Eric Shulman
2017-11-14 01:41:24 UTC
Permalink
As you know {{||$:/core/ui/TagTemplate}} displays a Tag Pill for the
current tiddler.
Does anyone know a way to retain all the functionality of a tag pill, ie
colour, dropdown list of tagged tiddlers (open all tiddlers provided by
plugin)
However allowing me to provide a different name eg "Tagging" rather than
the current tiddlers name?
You can modify the $:/core/macros/tag shadow tiddler definition. In the
tag-pill-inner definition, find this part:
<$view tiddler="""$tag$""" field="title" format="text"/>

and change it to this:
<$view tiddler="""$tag$""" field="tagtitle" format="text"><$view
tiddler="""$tag$""" field="title" format="text"/></$view>

Then, to override the default tag pill text (i.e., the title text), add a
field named "tagtitle" to the tag definition, and it will use that text as
the alternative to the tag tiddler's title text.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/9080581c-f651-412a-ac53-b2e8682b6e2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-11-14 09:43:27 UTC
Permalink
The tag macro does exactly that.


<<tag foo>>

will display the tag pill foo with all the expected behaviour (dropdown,
dragging, etc.)

I think that we may need to do another big overhaul of the documentation.
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/05a2ea45-e6c8-4cb0-92f2-f2481fa38eb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-11-14 09:47:06 UTC
Permalink
Sorry, I think I misunderstood what you are asking. The <<tag foo>> macro
is a shorter way to get {{foo||$:/core/ui/TagTemplate}}, but it doesn't
give a way to change the label on the tag.
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/dd62aab3-e4e9-4356-a1c3-77970634de64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2017-11-14 11:17:33 UTC
Permalink
Jed,

Yes, that seems to be the challenge.

I found the tag system macro in, $:/core/macros/tag
<http://192.168.1.109:8088/Local-Webdav-Files/TiddlyWiki5.html#%24%3A%2Fcore%2Fmacros%2Ftag>
but it uses the transclusion as well.

There is a tag-pill macro with no examples, but it seems to resort to a
transclusion as well.


Tony
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/fa1fa2b3-bbb1-4334-87fe-331c37c6084c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2017-11-14 02:20:16 UTC
Permalink
Eric,

That is an interesting solution, and I may use it in different
circumstances. It suites my interest in simplifying customisations even
more.

On this Occasion I want to to display a fixed value for all tiddlers that
are tagged with another, I should explain myself.

I want to create a Tagpill perhaps called "Tagging" which displays next to
the tiddler header which looks the same for every tiddler. A Consistent
name to look for, such that I can click on it and open any of the tiddlers
tagged by this one, or for which this one is Tagging.

Some tiddlers titles are too long to repeat their name in a such a tagpill.
It will then work like an old TWC tool that gave every tiddler a dropdown
to see what it tags,

It will also help my development workflow by letting me drag the set of
tiddlers so tagged to other wikis (without having to use the open tab in
the sidebar, to find a dragable link).

In addition It will only show this if the tiddler has any tags, allowing me
to identify at a glance if a given tiddler tags anything else.

Finally, If I can I would like to add a filter that would allow me to show
for example the tiddler is tagged with the current tiddler name AND the tag
"Active".

I looked to copying and reworking $:/core/ui/TagTemplate but realised I
could not fully understand it.

Regards
Tony
Post by Eric Shulman
As you know {{||$:/core/ui/TagTemplate}} displays a Tag Pill for the
current tiddler.
Does anyone know a way to retain all the functionality of a tag pill, ie
colour, dropdown list of tagged tiddlers (open all tiddlers provided by
plugin)
However allowing me to provide a different name eg "Tagging" rather than
the current tiddlers name?
You can modify the $:/core/macros/tag shadow tiddler definition. In the
<$view tiddler="""$tag$""" field="title" format="text"/>
<$view tiddler="""$tag$""" field="tagtitle" format="text"><$view
tiddler="""$tag$""" field="title" format="text"/></$view>
Then, to override the default tag pill text (i.e., the title text), add a
field named "tagtitle" to the tag definition, and it will use that text as
the alternative to the tag tiddler's title text.
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/8820bf38-8f46-4490-93b8-f9bfe23db11b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
PMario
2017-11-15 12:48:51 UTC
Permalink
Post by TonyM
Some tiddlers titles are too long to repeat their name in a such a
tagpill. It will then work like an old TWC tool that gave every tiddler a
dropdown to see what it tags,
You can enable the tiddler info section and have a look at the tagging tab.

-m
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/599faebd-d908-4d04-acdd-5a92157585e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-11-14 13:55:48 UTC
Permalink
I think that this is worth making something for so I will try and make an
alternate version of the tag template that lets you put in a different
label when I get home. Hopefully it won't take too long.
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/b15d6c3b-0767-438e-a598-70adc9dccf1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Diego Mesa
2017-11-14 01:35:20 UTC
Permalink
Hm,

I thought something like this would work:

{{!!alt-title||$:/core/ui/TagTemplate}}

but that also just shows the current tiddlers name.
Folks,
A Small request, I could not solve.
As you know {{||$:/core/ui/TagTemplate}} displays a Tag Pill for the
current tiddler.
Does anyone know a way to retain all the functionality of a tag pill, ie
colour, dropdown list of tagged tiddlers (open all tiddlers provided by
plugin)
However allowing me to provide a different name eg "Tagging" rather than
the current tiddlers name?
Thanks in advance
Tony
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/d6a5ed78-3ce8-43d7-bc6c-86f645d5f7a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-11-14 14:28:06 UTC
Permalink
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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.
TonyM
2017-11-15 12:55:17 UTC
Permalink
Jed,

A Quick go did not work for me, But I will look at it as soon as I finish
some other work, migrating an online shop.

I am glad you see the value in my suggestion and put some work into it.
Thanks

Regards
Tony
--
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+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/48d6362d-d278-4893-9916-26b6722dc271%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jed Carty
2017-11-15 13:07:23 UTC
Permalink
Sorry, I copied the wrong thing into the post. The macro at the end was
named tagLabel instead of just tag. Here is the fixed version, it just has
the marco name changed:


\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 tag(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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/536dcb0b-7170-4f08-a263-d0182e8d3929%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
TonyM
2017-11-15 21:32:42 UTC
Permalink
Thanks Jed,

That works very well, I think I will get it to float right of the current
tags in the view template. Wrapped to show only if there is a tiddler
tagged with the current tiddlers title.

<$list filter="[all[current]tagging[]limit[1]]" variable=null >
<<tag Here>>
</$list>


- Its great that the tag color comes through
- Tag pils can be presented with a fixed length despite underlying name,
allowing smarter presentation


However I also see other uses. I have a set of tags which have a suffix eg
action-wip action-done, with action or task as examples of the prefix.

It is now possible to provide a tag pill for wip and done irrespective of
what the prefix is,

Thanks for stepping int to help.
I see real value having this in the core.

Regards
Tony
Post by Jed Carty
Sorry, I copied the wrong thing into the post. The macro at the end was
named tagLabel instead of just tag. Here is the fixed version, it just has
\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 tag(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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/b145db71-34c9-4b4c-a3f6-48b47c29cfc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...