FET for sections?

40 views
Skip to first unread message

Dave Parker

unread,
Feb 20, 2009, 2:23:06 PM2/20/09
to TiddlyWiki
I've looked at all the examples in Udos ForEachTiddler plugin and
can't find reference to writing out sections

Could anyone get me started in writing something that would list a set
of, say 10 sections of a single tiddler (its one big tiddler with
hundreds of sections) starting at section 42?

e.g.

<<forEachTiddler
where
'tiddler.title = ("Book Three")'
sectionNumber = 42
write
'(index < 10) ? "* "+tiddler.section" " : ""'
>>

the above obviously doesn't work, but you get the drift...


Thanks,
Dave Parker

Morris Gray

unread,
Feb 20, 2009, 3:45:53 PM2/20/09
to TiddlyWiki
Here is an example I did for reading plugin headers. It's not only an
example, it is very practical for checking the version of your plugins
to keep them up to date. If you have TableSortingPlugin it is
sortable.

----------------------------------
<<forEachTiddler
where 'tiddler.tags.contains("systemConfig")'
sortBy 'tiddler.title.toLowerCase()'
write '"|[[" + tiddler.title +"]]" + "| [[" +tiddler.text.length
+"]]" + "|[[" +tiddler.modified.formatString("YYYY.0MM.0DD") + "]]|"
+ store.getTiddlerSlice(tiddler.title, "Author") + "|"
+ store.getTiddlerSlice(tiddler.title, "Version") + "|"
+ store.getTiddlerSlice(tiddler.title, "CoreVersion")+"|\n"'
begin '"|sortable|k\n"

+ "|!Plugin|!Size|!Modified|!Author|!Version|!CoreVersion|h
\n"'
>>
--------------------------------

Morris Gray
http://twhelp.tiddlyspot.com
A TiddlyWiki help file for beginners

Morris Gray

unread,
Feb 20, 2009, 3:51:38 PM2/20/09
to TiddlyWiki
By the way be careful of line breaks. The last line in particular

Morris

On Feb 21, 7:45 am, Morris Gray <msg...@symbex.net.au> wrote:
> Here is an example I did for reading plugin headers.  It's not only an
> example, it is very practical for checking the version of your plugins
> to keep them up to date.  If you have TableSortingPlugin it is
> sortable.
>
> ----------------------------------
> <<forEachTiddler
>      where 'tiddler.tags.contains("systemConfig")'
>      sortBy 'tiddler.title.toLowerCase()'
>      write '"|[[" + tiddler.title +"]]" + "| [[" +tiddler.text.length
> +"]]" + "|[[" +tiddler.modified.formatString("YYYY.0MM.0DD") + "]]|"
>          + store.getTiddlerSlice(tiddler.title, "Author") + "|"
>          + store.getTiddlerSlice(tiddler.title, "Version") + "|"
>          + store.getTiddlerSlice(tiddler.title, "CoreVersion")+"|\n"'
>      begin '"|sortable|k\n"
>
>          + "|!Plugin|!Size|!Modified|!Author|!Version|!CoreVersion|h
> \n"'
>  >>
> --------------------------------
>
> Morris Grayhttp://twhelp.tiddlyspot.com

Morris Gray

unread,
Feb 20, 2009, 4:06:49 PM2/20/09
to TiddlyWiki
While these are about slices they may still help you.

Here ia an improved slices plugin.

http://remotely-helpful.com/TiddlyWiki/ImprovedSlicesPlugin.html

Morris

On Feb 21, 6:23 am, Dave Parker <cedar...@telus.net> wrote:

cedardoc

unread,
Feb 20, 2009, 5:35:53 PM2/20/09
to TiddlyWiki
I'm struggling to get this to work...
Here's my FET I derived from yours

<<forEachTiddler
where 'tiddler.title.contains("BookOne")'
write
store.getTiddlerSection(tiddler.title, "1:1")
>>
Where "1:1" is the first section in BookOne

I get an error:
<<forEachTiddler ...>>: Extra parameter behind 'write': 1:1 )

Is it right to use the term "getTiddlerSection", and why is the
section name a problem?

And do I even need to use
" where 'tiddler.title.contains("BookOne")'" when I could later
just use
" store.getTiddlerSection("BookOne", "1:1")" (seeing as all the
info is coming from a single tiddler)?

Also I'm assuming I'll have to replace "1:1" with some kind of
variable and a loop??
Sorry I don't really understand "store.get"-type lingo...

Thanks for the help,
Dave

ps, I'll look at that link...thanks

Morris Gray

unread,
Feb 20, 2009, 8:05:42 PM2/20/09
to TiddlyWiki
This will get you everything in a section.
Obviously index < 10) ? won't work here because it applies to tiddlers
not tiddler##section contents.
-----------------------
<<forEachTiddler
where
'tiddler.tags.contains("links")'
sortBy '(tiddler.title)'
ascending
write
'"<<tiddler "+tiddler.title+"##Links1"+"\>\>\n"'
>>
-----------------------

Morris Gray
http://twhelp.tiddlyspot.com
A TiddlyWiki help file for beginners


cedardoc

unread,
Feb 21, 2009, 12:43:27 AM2/21/09
to TiddlyWiki
Thank you so much Morris for your time and attention. I'll tinker
with this over the weekend.

Dave

On Feb 20, 6:05 pm, Morris Gray <msg...@symbex.net.au> wrote:
> This will get you everything in a section.
> Obviously index < 10) ? won't work here because it applies to tiddlers
> not tiddler##section contents.
> -----------------------
> <<forEachTiddler
>  where
>  'tiddler.tags.contains("links")'
> sortBy '(tiddler.title)'
>  ascending
> write
>  '"<<tiddler "+tiddler.title+"##Links1"+"\>\>\n"'
>
> -----------------------
>
> Morris Grayhttp://twhelp.tiddlyspot.com
> > > > Dave Parker- Hide quoted text -
>
> - Show quoted text -

cedardoc

unread,
Feb 22, 2009, 1:41:41 AM2/22/09
to TiddlyWiki
Okay, Thank you Morris,

I used your help and some digging to get this to work:

http://worldenglishbible.tiddlyspot.com/#%5B%5BFET%20for%20first%209%20verses%20of%20a%20particular%20book%5D%5D

(sorry - it takes a long time to load - its got the entire bible in
it)

code:
<<forEachTiddler
where
'tiddler.tags.contains("book") && tiddler.title.contains("Matthew")'
sortBy '(tiddler.title)'
ascending
write
'"<<tiddler "+"[["+tiddler.title+"##1:1"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:2"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:3"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:4"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:5"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:6"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:7"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:8"+"]]"+"\>\>\n"+"<<tiddler
"+"[["+tiddler.title+"##1:9"+"]]"+"\>\>\n"'
>>

So I know how to //write// sections from a FET thingie, but I still
have a question:

Lets say I wanted to do a FET call (not sure of the proper
terminology) and get the same result, but not by listing out each
individual <<tiddler [[title##section]]>> like I've done there, but by
putting a single generic <<tiddler [[titleVariable##sectionVariable]]
>> in there and have the FET do a loop or index like thing that just
starts at a given section value and increases alphabetically (as all
my sections would increase numerically (yes I do realize, however that
I'll have to add a "0" at the first 9 verses of each book))

I've thought of trying to do this with placemarkers (or whatever
they're called: $1, $2 etc), but I'd like to have more than 9 at a
time, and besides, I still think it'd be easier to do it with
something like a "for/next loop"


Any suggestions?

Dave
> > - Show quoted text -- Hide quoted text -

cedardoc

unread,
Feb 22, 2009, 10:17:37 AM2/22/09
to TiddlyWiki
Nevermind - I've just realized I'm making things far more complicated
than they need to be.

I found Eric's SetTiddlerHeight script that solves the tiddler length
problem by turning long tiddlers into short ones with a scroll bar. I
should have known to look for something like that!

Thanks again Morris, I do intend to use FET more and know I know a bit
more thanks to you :-)

Dave

On Feb 21, 11:41 pm, cedardoc <cedar...@telus.net> wrote:
> Okay, Thank you Morris,
>
> I used your help and some digging to get this to work:
>
> http://worldenglishbible.tiddlyspot.com/#%5B%5BFET%20for%20first%209%...

Morris Gray

unread,
Feb 22, 2009, 6:17:51 PM2/22/09
to TiddlyWiki
Glad I could help Dave:-)

You also can scroll tiddler content by putting this in your StyleSheet
and adjusting the height to suit.

.scrollcontents {
height: 225px;
width: auto;
position:relative;
overflow: auto;
margin:auto;
margin-left:0em; }

then wrapping the particular tiddler's content like this

{{scrollcontents{
tiddler content
}}}


Morris Gray
http://twhelp.tiddlyspot.com
Reply all
Reply to author
Forward
0 new messages