Tagging macro improve

2 views
Skip to first unread message

N-Ice

unread,
May 27, 2006, 11:17:27 AM5/27/06
to TiddlyWikiDev
My first improve for TiddlyWiki
This version of the tagging also can print count of tagged items via
%1
Now we can use %1 param in label and etc.

======CODE==========

merge(config.macros.tagging,{
label: "%0 List (%1)",
labelNotTag: "%0 List (%1)",
tooltip: "List of tiddlers tagged with '%0' (%1)"});

======CODE==========

config.macros.tagging.handler =
function(place,macroName,params,wikifier,paramString,tiddler)
{
var theList = createTiddlyElement(place,"ul");
var title = "";
if(tiddler instanceof Tiddler)
title = tiddler.title;
if(params[0])
title = params[0];
var tagged = store.getTaggedTiddlers(title);

theList.setAttribute("title",this.tooltip.format([title,tagged.length]));
var prompt = tagged.length == 0 ? this.labelNotTag :this.label;

createTiddlyElement(theList,"li",null,"listTitle",prompt.format([title,tagged.length]));
for(var t=0; t<tagged.length; t++)

createTiddlyLink(createTiddlyElement(theList,"li"),tagged[t].title,true);

}

======CODE==========

P.S. I use tagging for see how many (Closed,Open)Tasks i have.

Udo Borkowski

unread,
May 30, 2006, 4:38:31 AM5/30/06
to TiddlyWikiDev
The suggested new labels have a significant effect on existing
TiddlyWikis. Currently the macro just displays the texts "tagging:" or
"not tagging". With the suggested change this will result in much
longer texts that may corrupt the layout of the tiddler, especially
when long tag names are used. Also it may be not so easy to quickly
identify the "tagging" buttons because of their changing titles
(currently the eye can immediately focus on the "tagging").

Also I personally never had the need to know the exact number of tagged
tiddlers, just to know if or if not tiddlers are tagged was sufficient.

Nevertheless if there is a need for this count information I suggest to
make it possible, but keep the old behaviour as the default.

I.e.

* Use the suggested code changes in config.macros.tagging.handler (i.e.
allow formatting the label/tooltip with title and count).
* Keep the old config labels/tooltip (without the %0, %1). When someone
has the need for the counts he can just overwrite these labels with
strings containing %0 and %1 (e.g. config.macros.tagging.label = "%0
List (%1)")

Jeremy Ruston

unread,
May 30, 2006, 5:11:33 AM5/30/06
to Tiddly...@googlegroups.com
OK, I've added a ticket for this:

http://trac.tiddlywiki.org/tiddlywiki/ticket/46

I reckon that Udo's right: we should make the code change because it's
pretty trivial, but keep the current lingo strings for backwards
compatibility.

Cheers

Jeremy.


--
Jeremy Ruston
mailto:jer...@osmosoft.com
http://www.tiddlywiki.com

Udo Borkowski

unread,
May 30, 2006, 5:33:41 AM5/30/06
to Tiddly...@googlegroups.com
Note that SergPodtynnyi has already added a ticket http://trac.tiddlywiki.org/tiddlywiki/ticket/45

I just added a "duplicate" comment there. I suggest that you close ticket 45 now (as "duplicate", if possible) so it does no go into the way.

Udo

N-Ice

unread,
May 30, 2006, 7:01:04 AM5/30/06
to TiddlyWikiDev
I think that's ok, and another question - is there a way to tagging
many tags like this
<<tagging OpenTask Contact>>
i know that the way is to using 2 tagging macros but it will be in
separated lists.

and also maybe a good feature to inclusive tagging

<<tagging Contact=>Friend >>
that will show list of the my friends contacts or it will be so
complicated with these feature.

Simon Baird

unread,
May 30, 2006, 7:13:12 AM5/30/06
to Tiddly...@googlegroups.com
You can do this kind of thing with TiddlerListMacro.
http://jackparke.googlepages.com/jtw.html#TiddlerListMacro

N-Ice

unread,
May 30, 2006, 9:09:23 AM5/30/06
to TiddlyWikiDev
oh.thank you, it's what i wanted, i think it's great plug-in and should
be native in TiddlyWiki.

Reply all
Reply to author
Forward
0 new messages