Re: Inventary of TODO

49 views
Skip to first unread message

Natxo Oyanguren

unread,
Oct 17, 2012, 12:45:07 PM10/17/12
to tiddl...@googlegroups.com
I've tried this code but only get the las TODO

<<forEachTiddler
     script 'function extract(str) {
         var patt=/\[ \].*/g;
         var r = [];
         if (patt.test(str)==true) {
             r.push(patt.exec(str));
         }
         return r
     };'
    write 'extract(tiddler.text).join("\n");'
 >>


??
El miércoles, 17 de octubre de 2012 13:28:06 UTC+2, Natxo Oyanguren escribió:
I'd like to calalog all my TODO, that I have in separate tiddlers. All of them have the same estructure:

[ ]I write here my TODO

I'm trying fetcching them all in a new tiddler using forEachTiddlerPlugin, but don't get the right reg expresion.

May be more than a TODO in the same tiddler.

Any help

Thanks

Natxo Oyanguren

unread,
Oct 17, 2012, 1:14:33 PM10/17/12
to tiddl...@googlegroups.com
Now with this code I get the first TODO from each tiddler, but can't get more TODOs if there are more than one in a tiddler...

<<forEachTiddler
     script 'function extract(str) {
         var patt=/\[ \].*\s/g;
         var r = patt.exec(str);
         if (r==null) {var r=[];}

         return r
     };'
    write 'extract(tiddler.text).join("\n");'
 >>

keep on trying

any help?

thanks

Eric Shulman

unread,
Oct 17, 2012, 1:21:49 PM10/17/12
to TiddlyWiki
>          var r = patt.exec(str);

Try this:
         var r = patt.match(str);

returns an array of matching items (or null if no matches).

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
Reply all
Reply to author
Forward
0 new messages