> I've written this in a tiddler called ListeMakro:
> <script label="ListT">
>    var titles=store.getTiddlerText("SomeList").readBracketedList();
>    for (var i=0; i<titles.length; i++) store.setTiddlerTag(titles
> [i],'tagName',true); // true=set, false=clear
> </script>
>
> and put in a custom viewtemplate (only used for tiddlers tagged with a
> certain tag) like this:
> <span class macro='tiddler ListeMakro'></span>
>
> I should now be able to run the macro on a bracketed list:

With the script as written above, you must put the bracketed list into
a tiddler named "SomeList".  You can, of course, change that name in
the script to any tiddler you want.  To refine the script a bit, you
can have it ask for the name of the 'source tiddler' containing the
list.  Add these two lines to the beginning of the script:
   var tid=prompt("Please enter the title of a source tiddler");
   if (!tid) return; /* cancelled by user */
Then, replace the line following them from:
   var titles=store.getTiddlerText("SomeList").readBracketedList();
to
   var txt=store.getTiddlerText(tid);
   if (!txt) { alert(tid+" not found"); return; }
   var titles=txt.readBracketedList();

When you click on the "ListT" command link, the script displays a
browser dialog box asking for input.   If you press cancel, the script
exits without doing anything else.  Otherwise, it attempts to retrieve
the contents of the indicated tiddler.  If unsuccessful (i.e., the
tiddler doesn't exist), an error is reported and the script exits.  If
content is retrieved, then the list of titles is extracted from the
text and the rest of the script then proceeds as before.

enjoy,
-e
--~--~---------~--~----~------------~-------~--~----~
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