ForEachTiddler and PartTiddlerPlugin

87 views
Skip to first unread message

amir

unread,
Nov 7, 2012, 5:46:24 PM11/7/12
to tiddl...@googlegroups.com
Hello all,

I am trying to come up to a solution to the following problem: I have tiddlers in which I have taken notes on my readings, and I am using the "partTiddlerPlugin" to define sections inside those tiddler that hold a definition. For example, I have a tiddler called [[bacteria]] and inside it I have a definition:

<part definition>
prokaryotic microorganism
</part>

I would like to define a tiddler called "definitions" in which all the tiddlers with a definition would appear in the following format:

TiddlerName: definition

It seems like a very repetitive task and although I have never used the "ForEachTiddler" pluggin, its name seems to be exactly what I need. I would need it to do: "for each tiddler with a part containing a definition, print the name of the tiddler, a colon, and the corresponding definition"

Is that at all possible with the ForEachTiddler pluggin ?

Thanks,

Amir


whatever

unread,
Nov 8, 2012, 3:34:58 AM11/8/12
to TiddlyWiki
Hi!
Yes, it's possible.
<<forEachTiddler where 'tiddler.tags.contains("Your Tag")' write
'"[["+tiddler.title+"]]: <<tiddler [["+tiddler.title+"/definition]]\>\>
\n"'>>

And if you want it to be a table:
<<forEachTiddler where 'tiddler.tags.contains("Your Tag")' write '"|
[["+tiddler.title+"]]|<<tiddler [["+tiddler.title+"/definition]]\>\>|
\n"' begin '"|Tiddler|Definition|h\n"'>>

w

amir

unread,
Nov 8, 2012, 1:15:19 PM11/8/12
to tiddl...@googlegroups.com
Hello,

Thanks for the reply, a preliminary test works :)
I was hoping however to extract definitions only from tiddlers that contained one. At this point I have not tagged the tiddler with a 'definition' tag. For example, I will have a tiddler called "bacteria" and it will contain a definition and another tiddler called "parasites" and it has no definition.

A common tag between the two tiddlers is something like 'research', but if I use this tag, then the current code will list the tiddler.title "parasites" and no definitions following it.

Is there a way to use only tiddlers for which the tiddler body text contains the sequence " <<part definition>> " as a filtering mechanism ?
Thanks a lot W for the code so far !

Amir

amir

unread,
Nov 8, 2012, 1:34:06 PM11/8/12
to tiddl...@googlegroups.com
Actually I figured it out, I used :
  where
           'tiddler.text.contains("part definition")'

and I have it working.
Thanks,

Amir

Shango

unread,
Nov 13, 2012, 1:40:22 AM11/13/12
to tiddl...@googlegroups.com
I had this same exact problem and solved it the same way.  The only thing I would add is to include the "<" just in case a tiddler has "part definition" it the text but is not actually a <part definition> ...

tiddler.text.contains("<part definition")'
Reply all
Reply to author
Forward
0 new messages