Hello Eric,
thanks for your reply!
and sorry for my late reply.... I didn't have time yet to try it...
anyways I tried it and it doesn't seem to work, could you point me to
where I'm mistaking?
my code is:
<<forEachTiddler where
'tiddler.tags.startsWith("ulcn").length > 0'
script '
Array.prototype.startsWith=function(txt) {
var out=[];
for (var i=0;i<tiddler.tags.length;i++)
if (tiddler.tags[i].substr(0,txt.length)==txt)
out.push(tiddler.tags[i]);
return out;
}
' >>
Thanks!
Greetings,
Geert
On Apr 1, 3:05 pm, Eric Shulman <[email protected]> wrote:
> On Apr 1, 2:10 am, geert Geurts <[email protected]> wrote:
>
> > Hello,
> > I'm using tiddly wiki allot for my work, and I use the forEachTiddler plugin
> > to organize my work.
> > Does anyone know of a way to make the forEachTiddler plugin able to make a
> > list of all tiddlers which have a tag that starts with "project", for
> > instance?
>
> Using a 'script' clause in your fET macro, you can define an Array
> prototype function that, given an array of strings (i.e., the 'tags'
> of a tiddler), returns a subset of the array containing only those
> strings that start with specified text:
>
> script '
> Array.prototype.startsWith=function(txt) {
> var out=[];
> for (var i=0;i<tiddler.tags.length;i++)
> if (tiddler.tags[i].substr(0,txt.length)==txt)
> out.push(tiddler.tags[i]);
> return out;
> }
> '
>
> Then, to test for the desired matching tags in the fET conditional,
> you can write:
> 'tiddler.tags.startsWith("project").length > 0'
>
> note: untested code
>
> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWiki?hl=en
-~----------~----~----~----~------~----~------~--~---