Hi Eric - this is true magic : - )
Of course *you* would say that it's easy -
I only had a hunch - that it ought to be easy - considering what I've
seen uptill now!!

2 questions:

1)
If I could make it work with any hr-seperated lists like this:

<<tiddler TiddlerContainingScript with SomeTiddlerName >>
It would be even better...
I presume it's a matter of changing ("SomeTiddler","") to ('$1','') ??

Am I on the right track?

2)
My next action with the hr-seperated list would be to add toggletag A
and toggletag B to each item - referring to the tiddlerLink -
Will it work in the table?

YS Måns Mårtensson

On 6 Sep., 20:20, Eric Shulman <elsdes...@gmail.com> wrote:
> > First question, I m not familiar with the term "hr-seperated list"..
>
> An 'HR-separated list' is a text-based syntax that I've developed and
> used in numerous TiddlyTools plugins and inline scripts.  Basically,
> it's a tiddler containing lines of text, divided up into 'items' of
> one or more lines, where each item is separated by a line containing a
> TW "HR" (horizontal rule) syntax: newline-4 dashes-newline (i.e.,
> "\n----\n").
>
> Two examples of HR-separated lists:
>    http://www.TiddlyTools.com/#Quotations
> and
>    http://www.TiddlyTools.com/#MiniBrowserList
>
> If the first case, each item is a text entry (a quotation) that can be
> randomly selected and displayed by QuoteOfTheDayPlugin.  In the second
> case, each item consists of two lines: the first line contains
> descriptive text, the second line contains a URL.  This information is
> then used by MiniBrowserPlugin to populate the 'bookmarks' list.
>
> To parse an HR-separated list in javascript code (plugin or inline
> script) is easy:
>
> var items=store.getTiddlerText("SomeTiddler","").split("\n----\n");
>
> This creates an array of strings, one for each item in the list.
> Then, loop over those items to process each one.  If each item has
> multiple lines, you can further split the text into separate lines
> (i.e., using .split('\n')). For example, to fill the 'bookmarks...'
> droplist in MiniBrowser:
>
> for (var i=0; i<items.length; i++) {
>    var lines=items[i].split("\n"); // 1st line=description, 2nd
> line=URL
>    list.options[list.length] = new Option(lines[0],lines[1]);
>
> }
>
> where 'list' is an HTML <select> element (i.e., a droplist/listbox)
>
> For Mans' specific use case, you could write something like this using
>    http://www.TiddlyTools.com/#InlineJavascriptPlugin
>
> <script>
> var out="";
> var items=store.getTiddlerText("SomeTiddler","").split("\n----\n");
> for (var i=0; i<items.length; i++) {
>    if (i>0 && i/5==Math.floor(i/5)) out += "|\n"; // start a new row
>    out += "|"+items[i]; // add item to row}
>
> out += "|\n"; // end last row
> return out;
> </script>
>
> The script constructs the desired TW table syntax into a string
> variable (out), and then returns that string.  InlineJavascriptPlugin
> then automatically passes that returned text to the core's wikify()
> function to render the table into your output.
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools / ELS Design Studios
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to tiddlywiki@googlegroups.com
To unsubscribe from this group, send email to 
tiddlywiki+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to