Cutting a part of the body

3 views
Skip to first unread message

Ronny

unread,
May 5, 2009, 5:58:45 PM5/5/09
to TiddlyWiki
I want to generate a todo list on a weekly basis.
The idea is that I type in a tiddler a certain string:
TODO_WK918: Some text

And in some other place:
TODO_WK918.4: Some text 2

Using a plugin to iterate over all tiddlers, I'm able to find all
tiddlers that contain this string and display the title / body of the
tiddler in an automatic way. But this is not what I want.
I want to generate a list that contains one line per todo entry. The
line should contain the "Some text" part of the TODO, i.e.:
TODO_WK918.3: Some text
TODO_WK918.4: Some text 2

So I basically need to know how to cut a part of the tiddler"s body
and display this in a list.
Can somebody help me with this?

Thanks

This is how I loop over all tiddlers:
<<forEachTiddler
where ' tiddler.text.contains("WK919") && tiddler.tags.contains
("_task")'
write 'tiddler.text+"\n"'
>>

Eric Shulman

unread,
May 5, 2009, 6:34:42 PM5/5/09
to TiddlyWiki
> I want to generate a list that contains one line per todo entry. The
> line should contain the "Some text" part of the TODO, i.e.:
> TODO_WK918.3: Some text
> TODO_WK918.4: Some text 2

The following inline script [1] uses a 'regular expression' to match
and display all occurences of a given text pattern from all tiddlers
with a specified tag

<script>
var out=[];
var pat=/TODO_WK[0-9]{3}(.*)\n/g;
var tids=store.getTaggedTiddlers('_task');
for (var i=0; i<tids.length; i++) {
var match=pat.exec(tids[i].text);
while (match) {
out.push(match[0]);
match=pat.exec(tids[i].text);
}
}
return out.join('');
</script>

[1] http://www.TiddlyTools.com/#InlineJavascriptPlugin

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Ronny

unread,
May 6, 2009, 1:03:20 PM5/6/09
to TiddlyWiki
It works very well!!
Thanks a lot.

Reply all
Reply to author
Forward
0 new messages