Sorry all! After examining it further and playing around with
javascript in the live preview plugin, I found the answer to my
question about the conditional as well as the fix for my plugin.
In case anyone else with limited javascript experience wanted to know
the answer, the !tag in the if(!tag ||
tag.tags.contains("excludeLists")) conditional is there to prevent an
error. When it's referring to tag, it's not referring to the title of
the tag, but to a tiddler corresponding to that tag (e.g. if it were
excludeSearch, it wouldn't be checking to see if excludeSearch is an
entry in a tag list, it would be checking to see if there is a tiddler
named excludeSearch in the current TiddlyWiki or store). If tag
doesn't exist as an actual tiddler yet, calling
tag.tags.contains("excludeLists") would throw an error since it would
be querying a non-existent tiddler.
I'm sure this was obvious to anyone with any experience in serious
programming, but the fix to my plugin was to add a similar check in
the conditional if(!config.options.chkHttpReadOnly || !
tag.tags.contains(config.options.txtEditorOnlyTag))
The final plugin code is now the following:
//{{{
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"," ");
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(!config.options.chkHttpReadOnly || (tag
&& !
tag.tags.contains(config.options.txtEditorOnlyTag))) {
if(!label)
label =
createTiddlyElement(ul,"li",null,"listTitle",lingo.labelTags.format([tiddle
r.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([tidd
ler.title]));
};
//}}}
(with {{{config.options.txtEditorOnlyTag = excludeSearch;}}} in my
configOptions tiddler)
Sorry for being completely daft!
Thanks,
Scott
> 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]));