table - horizontal column generation

16 visninger
Gå til det første ulæste opslag

M)

ulæst,
20. mar. 2009, 09.15.0420.03.2009
til TiddlyWiki
This crazy idea is to populate columns in a table with content from a
list.

1. got to do now
1. another important task
2. do soon
3. do in a month
4. on the back burner
2. maybe it can be in any order

it would then generate a table like this...

|got to do now<br>another important task|do soon<br>maybe it can be in
any order|do in a month|on the back burner|

This example would produce a single row and that is good enough for
me, however, I can see that a plugin could produce a multi row table.

Doable?

M)

ulæst,
20. mar. 2009, 12.50.2820.03.2009
til TiddlyWiki
'Why?' you might ask. This presents like a timeline of tasks. The
only way I can do it now is by creating a table with <br> which is
difficult to update. Another way is by using the tiddler macro, which
makes things easier to find, but adds additional effort in tiddler
management. This option presents nice and clean, all in one place,
and easily tweaked (e.g., change a '1' to a '2').

'Why not use one of the todo list options that are available?' I've
tried ones that held promise for me but I have yet to latch on to
any.

Eric Shulman

ulæst,
20. mar. 2009, 14.01.1420.03.2009
til TiddlyWiki
> This crazy idea is to populate columns in a table with content from a
> list.

Basically, what you want is a generator that reads content in one
format and writes it out in a different format, based on some
programmatic rules. Fortunately, this is reasonably easy to do by
using a combination of a tiddler section and TiddlyTools'
InlineJavascriptPlugin, like this:

[[SomeTiddler]]
---------------------------
/%
!tasks
1. got to do now
1. another important task
2. do soon
3. do in a month
4. on the back burner
2. maybe it can be in any order
!end
%/<script>
var here=story.findContainingTiddler(place); if (!here) return;
var lines=store.getTiddlerText(here.getAttribute('tiddler')
+'##tasks','').split('\n');
var out=[]; for (var i=0; i<lines.length; i++) {
var c=parseInt(lines[i]); if (isNaN(c)) continue;
out[c-1]=(out[c-1]?out[c-1]+'<br>':'')+lines[i].replace(new RegExp(c
+'\. '),'');
}
return '\n|'+out.join('|')+'|\n';
</script>
---------------------------------------

The first part of the tiddler defines a *hidden section* called
'tasks', into which you type your input list. The second part of the
tiddler is the script that parses the lines of text from the 'tasks'
section of the current tiddler and adds them to an array of column
text, based on the numeric prefix value on each line. That array is
then assembled into a TW table (i.e., leading/trailing "|", plus a "|"
in between each item) and returned by the script so that it will be
automatically rendered into the tiddler display.

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Ken Girard

ulæst,
20. mar. 2009, 14.31.3120.03.2009
til TiddlyWiki
Eric, could you do your magic and make it fill in like your
CommentsPlugin?
Push button, write task, submit, repeat till I'm out of task to add,
refresh, and start doing the task in order. Realize I have a new task,
push button, write task, etc.

Of course then they are going to want a way to remove a task once it
is done...
And at that point you have a full system.

M) have you thought about using a tiddler titled ToDo, and then having
task tagged ToDo and titled like you have in your example? Open ToDo,
and let TWs built in tagged macro show you a list of projects in
numeric order.

Ken Girard

M)

ulæst,
20. mar. 2009, 14.48.2820.03.2009
til TiddlyWiki
Amazing. I wish I knew javascript!
Svar alle
Svar til forfatter
Videresend
0 nye opslag