I was able to change my ViewTemplate and StyleSheet so that a
tiddler's tags are displayed under the tiddler, and aligned left in a
box the width of the tiddler.

However, I would like the tags to be displayed all in a line,
separated by commas or a pipe character ( | ) or even spaces.

I thought I had seen something done like this when I first set up a
tiddlywiki, but this is a couple years back, and the method involved
altering the tw's code. I tried going down the path of figuring out
how to change the code again and it isn't working, but I determined
that the tags handler below is where the list is being rendered.

Can someone point me in the right direction? I'm sure there are
provisions to reformat the way tags are displayed for a tiddler?

Thanks.

And now the code:

/*
#########################################################################################
CHANGE HOW TAGS ARE DISPLAYED FROM A LIST TO ALL IN ONE LINE
THE TAGS SEEM TO BE RENDERED FROM HERE...
*/

config.macros.tags.handler =
function(place,macroName,params,wikifier,paramString,tiddler)
{
        params = paramString.parseParams("anon",null,true,false,false);
        var ul = createTiddlyElement(place,"ul");
        var title = getParam(params,"anon","");
        if(title && store.tiddlerExists(title))
                tiddler = store.getTiddler(title);
        var sep = getParam(params,"sep"," ");
//CONFIRMS THIS IS WHERE IT IS BEING RENDERED:
//sep = ",";
        var lingo = config.views.wikified.tag;
        var label = null;
        for(var t=0; t<tiddler.tags.length; t++) {
                var tag = store.getTiddler(tiddler.tags[t]);
                if(!tag || !tag.tags.contains("excludeLists")) {
                        if(!label)
                                label =
createTiddlyElement(ul,"li",null,"listTitle",lingo.labelTags.format([tiddler.title]));
        
createTagButton(createTiddlyElement(ul,"li"),tiddler.tags[t],tiddler.title);
                        if(t<tiddler.tags.length-1)
                                createTiddlyText(ul,sep);
                }
        }
        if(!label)
        
createTiddlyElement(ul,"li",null,"listTitle",lingo.labelNoTags.format([tiddler.title]));
};

/*
#########################################################################################
NOTE: I FORGET WHERE I FOUND THIS
BUT FOR SOME REASON I HAD CODE THAT REPLACED THIS
*/

config.macros.tagging.handler =
function(place,macroName,params,wikifier,paramString,tiddler)
{
        params = paramString.parseParams("anon",null,true,false,false);
        var ul = createTiddlyElement(place,"ul");
        var title = getParam(params,"anon","");
        if(title == "" && tiddler instanceof Tiddler)
                title = tiddler.title;
        var sep = getParam(params,"sep"," ");
//sep = ",,";
        ul.setAttribute("title",this.tooltip.format([title]));
        var tagged = store.getTaggedTiddlers(title);
        var prompt = tagged.length == 0 ? this.labelNotTag : this.label;
        
createTiddlyElement(ul,"li",null,"listTitle",prompt.format([title,tagged.length]));
        for(var t=0; t<tagged.length; t++) {
                
createTiddlyLink(createTiddlyElement(ul,"li"),tagged[t].title,true);
                if(t<tagged.length-1)
                        createTiddlyText(ul,sep);
        }
};

/*
#########################################################################################
WITH THIS:

config.macros.tagging.handler =
function(place,macroName,params,wikifier,paramString,tiddler)
{
        params = paramString.parseParams("anon",null,true,false,false);
        var ul = createTiddlyElement(place,"ul");
        var title = getParam(params,"anon","");
        if(title == "" && tiddler instanceof Tiddler)
                title = tiddler.title;
        var sep = getParam(params,"sep"," ");
        ul.setAttribute("title",this.tooltip.format([title]));
        var tagged = store.getTaggedTiddlers(title);
        var prompt = tagged.length == 0 ? this.labelNotTag : this.label;
//
createTiddlyElement(ul,"li",null,"listTitle",prompt.format([title,tagged.length]));
        for(var t=0; t<tagged.length; t++) {
//
createTiddlyLink(createTiddlyElement(ul,"li"),tagged[t].title,true);
                if(t<tagged.length-1)
                        createTiddlyText(ul,sep);
        }
};

END CHANGES
#########################################################################################
*/

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to