Hi
At last I made it work with the script inside the fET.
I had to abandon the sliderframe.
The result is vewable here: 
http://bibtw.tiddlyspot.com/index.html#Books%26Articles

Code:
<<forEachTiddler where 'tiddler.tags.contains("bibentry")'
sortBy  'tiddler.title.toUpperCase()'
script
 '
function getFirstLine(s) {
 var m = s.match(/\s*(.*)/);
 return m != null && m.length >= 1 ? m[1] : "";
 }
 '
write
'(index < 200)? "|"+(index+1)+"|[["+tiddler.title+"]] |
[["+tiddler.data("author")+"]] | [["+tiddler.data("primtopic")+"]] |
[img(3em+,)["+store.getValue(tiddler,"title")+" |"+store.getValue
(tiddler,"image")+"]["+tiddler.title+"]] | [["+tiddler.title+"-note]]
| [["+tiddler.data("location")+"]] |<<editTiddler [["+tiddler.title+"]]
$))&rarr;~~//"+getFirstLine(tiddler.text)+"//~~ |\n" : ""'
              begin '"|sortable|k\n"
+"|>|>|>|>|>|>|>|>| !<<wikify [[%0]] ti...@here \>\> |h\n"
+"| # | [[Title|By title]] | [[Author|Bibliography by author]] |
[[Topic|By primary topic]] | !Cover | [[Note|NoteArchive]] | <<tag
Location\>\> | Edit |h\n"'
end 'count+" books and articles\n"' none '"no books or articles\n"'>>

YS Måns Mårtensson

On 24 Maj, 02:32, Måns <[email protected]> wrote:
> Hi TwWizards
>
> I'm trying to get the first line of text from tiddlers fetched by fET
> into a table...
> I often need to refer to the firstline of a tiddler - and keep it as
> one line - not to break a table, so I would appreciate any help on
> this matter..
>
> I've tried to do it like this (and I get <<sitemap error..):
> <<forEachTiddler where 'tiddler.tags.contains("bibentry")'
> sortBy 'tiddler.fields["title"]'
>  script
>  '
> function getFirstLine(s) {
>  var m = s.match(/\s*(.*)/);
>  return m != null && m.length >= 1 ? m[1] : "";
>  }
>  '
> write
> '(index < 200)? "|"+(index+1)+"|[["+tiddler.title+"]] |
> [["+tiddler.data("author")+"]] | [["+tiddler.data("primtopic")+"]] |
> [img(3em+,)["+store.getValue(tiddler,"title")+" |"+store.getValue
> (tiddler,"image")+"]["+tiddler.title+"]] | [["+tiddler.title+"-note]]
> | [["+tiddler.data("location")+"]] | <<editTiddler [["+tiddler.title
> +"]]$)) | *<<siteMap [["+tiddler.title+"]] . sliders$))&rarr;
> ~~//"+getFirstLine(tiddler.text)+"//~~ |\n" : ""'
>               begin '"|sortable|k\n"
> +"|>|>|>|>|>|>|>|>| !<<wikify [[%0]] ti...@here \>\> |h\n"
> +"| # | [[Title|By title]] | [[Author|Bibliography by author]] |
> [[Topic|By primary topic]] | !Cover | [[Note|NoteArchive]] | <<tag
> Location\>\> | Edit |h\n"'
> end 'count+" books\n"' none '"no books\n"'>>
>
> I wonder if I could use a tiddler with the script instead - and put it
> into the table afterwards. The script in a tiddler called
> "FirstLines":
> <<forEachTiddler
>  where
>  'tiddler.tags.contains(context.viewerTiddler.title)' ??????
>  script
>  '
> function getFirstLine(s) {
>  var m = s.match(/\s*(.*)/);
>  return m != null && m.length >= 1 ? m[1] : "";
>  }
>  '
> write
> '"*<<siteMap [["+tiddler.title+"]] . sliders$))&rarr;
> ~~//"+getFirstLine(tiddler.text)+"//~~\n"'
>
>  Put it in a table:
> <<forEachTiddler where 'tiddler.tags.contains("bibentry")'
> sortBy 'tiddler.fields["title"]'
> write
> '(index < 200)? "|"+(index+1)+"|[["+tiddler.title+"]] |
> [["+tiddler.data("author")+"]] | [["+tiddler.data("primtopic")+"]] |
> [img(3em+,)["+store.getValue(tiddler,"title")+" |"+store.getValue
> (tiddler,"image")+"]["+tiddler.title+"]] | [["+tiddler.title+"-note]]
> | [["+tiddler.data("location")+"]] | <<editTiddler [["+tiddler.title
> +"]]$)) <<tiddler FirstLines\>\> |\n" : ""'
>               begin '"|sortable|k\n"
> +"|>|>|>|>|>|>|>|>| !<<wikify [[%0]] ti...@here \>\> |h\n"
> +"| # | [[Title|By title]] | [[Author|Bibliography by author]] |
> [[Topic|By primary topic]] | !Cover | [[Note|NoteArchive]] | <<tag
> Location\>\> | Edit |h\n"'
> end 'count+" books\n"' none '"no books\n"'>>
>
> I've tried - with no effect.
> I believe that it is due to a wrong expression in the fET here: where
>  'tiddler.tags.contains(context.viewerTiddler.title)'
>
> When I use this expression it's referring to the tiddler in which the
> table is and not the tiddler fetched by the fET..
> I'm sure I've done this before - but I can't remember...
>
> If you'd like to have a look at the table - and maybe give it a
> try:http://bibtw.tiddlyspot.com/#Books%26Articles
>
> The FirstLines script/fET:http://bibtw.tiddlyspot.com/#FirstLines
>
> YS Måns Mårtensson
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to