[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Måns

Eric - is it somehow possible to make the script work on a
lineseperated list produced by a fET?
This would give infinite possibilites for producing tables with data
fetched from tiddlers - and sorted by the fET..

I know how to make a single multicolumned table in a fET already - but
it would add the ability to make "overflow" on *long* tables from very
simple fETs -

If a fET could actually "write" a real textlist - then this script
could format the list to a table..

Am I dreaming?

YS Måns Mårtensson

On 9 Sep., 01:59, Måns  wrote:
> Ok - Thanks for explaining...
> I've got it working now - and I am happy to say that it works on a
> simple lineseperated list as well as on a hr-seperated list.
> That's great - thanks a lot!
>
> YS Måns Mårtensson
>
> On 9 Sep., 01:21, Eric Shulman  wrote:
>
>
>
> > > I tried to implement these line in the first script like this:
> > > 
> > > var out="";
> > > var txt=store.getTiddlerText("$1","");
> > > var items=txt.split("\n\n"); {
> > > if (!items[1]) items=txt.split("\n"); // start a new row
> > > out += "|"+items[i]; // add item to row
>
> > > }
> > > out += "|\n"; // end last row
> > > return out;
> > > 
>
> > Well, it would help if you hadn't *removed* the part of the code that
> > actually *loops* over the entire list of items.  Go back to my first
> > post in this thread that contained the complete script.  You should
> > just replace the original line that fetches the 'items' array with the
> > 3 lines that fetches it using either format, and leave the for (...)
> > loop statement as-is, so that each retrieved item can be processed and
> > added to the output.
>
> > -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Måns

Ok - Thanks for explaining...
I've got it working now - and I am happy to say that it works on a
simple lineseperated list as well as on a hr-seperated list.
That's great - thanks a lot!

YS Måns Mårtensson

On 9 Sep., 01:21, Eric Shulman  wrote:
> > I tried to implement these line in the first script like this:
> > 
> > var out="";
> > var txt=store.getTiddlerText("$1","");
> > var items=txt.split("\n\n"); {
> > if (!items[1]) items=txt.split("\n"); // start a new row
> > out += "|"+items[i]; // add item to row
>
> > }
> > out += "|\n"; // end last row
> > return out;
> > 
>
> Well, it would help if you hadn't *removed* the part of the code that
> actually *loops* over the entire list of items.  Go back to my first
> post in this thread that contained the complete script.  You should
> just replace the original line that fetches the 'items' array with the
> 3 lines that fetches it using either format, and leave the for (...)
> loop statement as-is, so that each retrieved item can be processed and
> added to the output.
>
> -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Eric Shulman

> I tried to implement these line in the first script like this:
> 
> var out="";
> var txt=store.getTiddlerText("$1","");
> var items=txt.split("\n\n"); {
> if (!items[1]) items=txt.split("\n"); // start a new row
> out += "|"+items[i]; // add item to row
>
> }
> out += "|\n"; // end last row
> return out;
> 

Well, it would help if you hadn't *removed* the part of the code that
actually *loops* over the entire list of items.  Go back to my first
post in this thread that contained the complete script.  You should
just replace the original line that fetches the 'items' array with the
3 lines that fetches it using either format, and leave the for (...)
loop statement as-is, so that each retrieved item can be processed and
added to the output.

-e

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Måns

Eric

> Alternatively, here's some general-purpose code that first tries to
> split the text on the HR separator... and if only one item results
> (i.e., there are *no* HR separators in the text), then tries splitting
> on just a simple newline, allowing either format to be used, as
> appropriate:
>
>    var txt=store.getTiddlerText("$1","");
>    var items=txt.split("\n\n");
>    if (!items[1]) items=txt.split("\n");

I tried to implement these line in the first script like this:

var out="";
var txt=store.getTiddlerText("$1","");
var items=txt.split("\n\n"); {
if (!items[1]) items=txt.split("\n"); // start a new row
out += "|"+items[i]; // add item to row
}

out += "|\n"; // end last row
return out;


But I only get the first line/first cell of the table.
What would the working script look like?

YS Måns Mårtensson

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Eric Shulman

> I guess, above all, slices allow you to put any context around them,
> without influencing your ability to list them.
> So you're not constrained to a "well-formed" hr-separated list.

Slices *are* very useful.  However, there are some limitations that
you should be aware of:

You need to know what the slice names are in order to access the
values, and each slice has to have a unique name within the tiddler.
In addition, slices cannot contain multiple lines of text, nor can
they use the "|" symbol (assuming the slices are defined using TW
table format).

In contrast, HR-separated lists are simple sequences of *unnamed*
items, and can contain multiple lines consisting of any sequence of
characters except, of course, for a line containing just an HR (),
as this would signal the end of one item and the start of the next.

-e



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-08 Thread Tobias

Hi Måns...

I guess, above all, slices allow you to put any context around them,
without influencing your ability to list them.
So you're not constrained to a "well-formed" hr-separated list.

Tobias.

On Sep 8, 12:20 am, Måns  wrote:
> Thanks for the hint Tobias - I haven't used sections and slices very
> much yet.
> I've been using fields, tags and fETs to retrieve information for use
> in tables.
> If you think it's a good idea in this context - I will try to learn
> how ..
>
> YS Måns Mårtensson
>
> On 7 Sep., 23:48, Tobias  wrote:
>
>
>
> > Thanks for the detailed information.
>
> > So, I understand that, just as tables, those  separated lists are
> > a concise way to structure information which you just don't want to go
> > down some "one tiddler for each item" approach.
>
> > As for that, maybe slices and sections in combination with scripting
> > and listMacros are interesting to you as 
> > well:http://tiddlywiki.org/wiki/Transclusion#Partial_Transclusion
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Måns

Thanks for the hint Tobias - I haven't used sections and slices very
much yet.
I've been using fields, tags and fETs to retrieve information for use
in tables.
If you think it's a good idea in this context - I will try to learn
how ..

YS Måns Mårtensson

On 7 Sep., 23:48, Tobias  wrote:
> Thanks for the detailed information.
>
> So, I understand that, just as tables, those  separated lists are
> a concise way to structure information which you just don't want to go
> down some "one tiddler for each item" approach.
>
> As for that, maybe slices and sections in combination with scripting
> and listMacros are interesting to you as 
> well:http://tiddlywiki.org/wiki/Transclusion#Partial_Transclusion
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Tobias

Thanks for the detailed information.

So, I understand that, just as tables, those  separated lists are
a concise way to structure information which you just don't want to go
down some "one tiddler for each item" approach.

As for that, maybe slices and sections in combination with scripting
and listMacros are interesting to you as well:
http://tiddlywiki.org/wiki/Transclusion#Partial_Transclusion
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Måns

I simply wanted:

1) A table with several rows for better visual overview
2) Yet another way to benefit from a list, that I already use in
another context.
   a) For each new use of a source (list) - inside the same TW the
nearer it gets to be a real database.
   b) Economics - less input - more output - I like that!
3) I wikikilinked the listitems in the hr-list (with double brackets)
- which I use in the Qoute of the dayPlugin - to open the
corresponding tiddlers from their titles in the QOTD - Quite handy. -
a) I use of the Qoute of the day Plugin to autogenerate proposals
for sets of songs (repertoire).
I can click near the title and get a new proposal - or click
directly on the songtitle - and open the songs tiddler. (I've made
tables with several QOTD's to get a list of different songs each time
I refresh display )
b) In the table with all songs from the songbook I get an overview
- and the ability to click a title to open a song.
Songtitles are often short - and they fit nicely in a large
tablerepresentation ...
A very long hr-list with small list items doesn't provide a
good overview - and it seems like a waste of space - when you have to
do a lot of scrolling..
I haven't finished modifying the hr-list yet - I'd like to add
toggletags to each listitem - ...
I hope this answers your question..

Regards Måns Mårtensson

On 7 Sep., 17:33, Tobias Beer  wrote:
> Sorry, no Danish language skills on my part... What's the general purpose of
> your table as compared to the tiddler simply containing the hr-separated
> list?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Tobias Beer
Sorry, no Danish language skills on my part... What's the general purpose of
your table as compared to the tiddler simply containing the hr-separated
list?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Måns

Hi Tobias

I am using the script for splitting the text on the HR separator and
putting the results in a table here:
http://dl.getdropbox.com/u/1064531/SangTimer/SangTimer.html#SangBogen2Table

I hope you can find your way - it's in Danish...

The TW is a work in progress - and I haven't decided which variant of
the script I will use yet..

Regards Måns Mårtensson

On 7 Sep., 16:38, Tobias  wrote:
> Hi Måns,
>
> Can you show us the final solution which you're using after all of
> this?
> I'd be interested in seeing it work rather than reading about how it
> should ;-)
>
> Tobias.
>
> On Sep 7, 1:58 am, Måns  wrote:
>
>
>
> > Thanks a lot Eric
>
> > As you know I like many options :-)
>
> > YS Måns Mårtensson
>
> > On 6 Sep., 22:13, Eric Shulman  wrote:
>
> > > > Can I "automake" a hr-seperated list from a normal lineseperated list
> > > > with quickeditplugin in some way?
>
> > > If the tiddler contains single lines, you could use it as is, by
> > > changing the script from
> > >    var items=store.getTiddlerText("$1","").split("\n\n")
> > > to just
> > >    var items=store.getTiddlerText("$1","").split("\n");
>
> > > Alternatively, here's some general-purpose code that first tries to
> > > split the text on the HR separator... and if only one item results
> > > (i.e., there are *no* HR separators in the text), then tries splitting
> > > on just a simple newline, allowing either format to be used, as
> > > appropriate:
>
> > >    var txt=store.getTiddlerText("$1","");
> > >    var items=txt.split("\n\n");
> > >    if (!items[1]) items=txt.split("\n");
>
> > > enjoy,
> > > -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-07 Thread Tobias

Hi Måns,

Can you show us the final solution which you're using after all of
this?
I'd be interested in seeing it work rather than reading about how it
should ;-)

Tobias.


On Sep 7, 1:58 am, Måns  wrote:
> Thanks a lot Eric
>
> As you know I like many options :-)
>
> YS Måns Mårtensson
>
> On 6 Sep., 22:13, Eric Shulman  wrote:
>
>
>
> > > Can I "automake" a hr-seperated list from a normal lineseperated list
> > > with quickeditplugin in some way?
>
> > If the tiddler contains single lines, you could use it as is, by
> > changing the script from
> >    var items=store.getTiddlerText("$1","").split("\n\n")
> > to just
> >    var items=store.getTiddlerText("$1","").split("\n");
>
> > Alternatively, here's some general-purpose code that first tries to
> > split the text on the HR separator... and if only one item results
> > (i.e., there are *no* HR separators in the text), then tries splitting
> > on just a simple newline, allowing either format to be used, as
> > appropriate:
>
> >    var txt=store.getTiddlerText("$1","");
> >    var items=txt.split("\n\n");
> >    if (!items[1]) items=txt.split("\n");
>
> > enjoy,
> > -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Måns

Thanks a lot Eric

As you know I like many options :-)

YS Måns Mårtensson

On 6 Sep., 22:13, Eric Shulman  wrote:
> > Can I "automake" a hr-seperated list from a normal lineseperated list
> > with quickeditplugin in some way?
>
> If the tiddler contains single lines, you could use it as is, by
> changing the script from
>    var items=store.getTiddlerText("$1","").split("\n\n")
> to just
>    var items=store.getTiddlerText("$1","").split("\n");
>
> Alternatively, here's some general-purpose code that first tries to
> split the text on the HR separator... and if only one item results
> (i.e., there are *no* HR separators in the text), then tries splitting
> on just a simple newline, allowing either format to be used, as
> appropriate:
>
>    var txt=store.getTiddlerText("$1","");
>    var items=txt.split("\n\n");
>    if (!items[1]) items=txt.split("\n");
>
> enjoy,
> -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread AlanBCohen

Eric,
Thanks for the information on the HR formatted lists as well as te
answer as to how to parse it.
Alan
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Eric Shulman

> Can I "automake" a hr-seperated list from a normal lineseperated list
> with quickeditplugin in some way?

If the tiddler contains single lines, you could use it as is, by
changing the script from
   var items=store.getTiddlerText("$1","").split("\n\n")
to just
   var items=store.getTiddlerText("$1","").split("\n");

Alternatively, here's some general-purpose code that first tries to
split the text on the HR separator... and if only one item results
(i.e., there are *no* HR separators in the text), then tries splitting
on just a simple newline, allowing either format to be used, as
appropriate:

   var txt=store.getTiddlerText("$1","");
   var items=txt.split("\n\n");
   if (!items[1]) items=txt.split("\n");

enjoy,
-e

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Måns

Eric - You've made my day  - and have certainly given me a new
indispensable tool for making tables...
Thanks a *lot*

Ps: It is very satisfying to be able to use the same list for
different purposes -
Btw:
Can I "automake" a hr-seperated list from a normal lineseperated list
with quickeditplugin in some way?


YS Måns Mårtensson


On 6 Sep., 21:14, Eric Shulman  wrote:
> > <>
> > I presume it's a matter of changing ("SomeTiddler","") to ('$1','') ??
> > Am I on the right track?
>
> Yup.  That will work.  (note: the "with:" param above needs to have a
> ":" on the end of it)
>
> > 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?
>
> The script output is processed as TW wiki syntax, so any macros, etc.
> that occur in the list items should be handled when the output is
> rendered.
>
> enjoy,
> -e
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Eric Shulman

> <>
> I presume it's a matter of changing ("SomeTiddler","") to ('$1','') ??
> Am I on the right track?

Yup.  That will work.  (note: the "with:" param above needs to have a
":" on the end of it)

> 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?

The script output is processed as TW wiki syntax, so any macros, etc.
that occur in the list items should be handled when the output is
rendered.

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



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Måns

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:

<>
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  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    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  element (i.e., a droplist/listbox)
>
> For Mans' specific use case, you could write something like this using
>    http://www.TiddlyTools.com/#InlineJavascriptPlugin
>
> 
> var out="";
> var items=store.getTiddlerText("SomeTiddler","").split("\n\n");
> for (var i=0; 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;
> 
>
> 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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread Eric Shulman

> 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 element (i.e., a droplist/listbox)

For Mans' specific use case, you could write something like this using
   http://www.TiddlyTools.com/#InlineJavascriptPlugin


var out="";
var items=store.getTiddlerText("SomeTiddler","").split("\n\n");
for (var i=0; i0 && 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;


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
-~--~~~~--~~--~--~---



[tw] Re: How to turn a hr-seperated list into a table with several columns?

2009-09-06 Thread AlanBCohen

First question, I m not familiar with the term "hr-seperated list"..
Do you mean a list which has each item separated by a 'hard return' or
 combination?  Or is there some other
character string separating the items?  If this is a one-time
occurrence to take this list and change it,I'd suggest copying the
body of the list into an external text file.  Then use the text editor
(of your choice) to insert a pipe character "|" as a replacement for
the deliminator.  Then, manually insert a carriage return after every
fifth entry to break the list up into columns. You will probably need
to insert several other pipes to finish the task.
Another possibility would be to use a language like 'awk' to process
the list, but I don't think the learning curve justifies a one-time
use.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---