script ' function lastDays(tiddler) { var compareDate = new Date(); compareDate.setDate(compareDate.getDate() - 5); if (tiddler.modified > compareDate && !tiddler.tags.contains("excludeLists") && !tiddler.tags.contains("systemConfig") && tiddler.tags.contains("bookfile")){ var previewText = tiddler.text.substring(0,150).replace(/(\r\n|\n|\r)/gm," ") + "..."; return "[[" + tiddler.title + "]]\n{{small borderleft{" + previewText + "}}}\n\n";} else return ""; } '
write 'context.output+= lastDays(tiddler) , ""'
begin 'context.output = ""'
end 'context.output ? context.output : "<<tiddler [[List the 4 most recently modified tiddlers]]\>\>" ' >>
The problem is that tiddlywiki evidently runs the wikify command after all the content has been written, resulting in a number of markup errors (e.g. unclosed //, @@, etc.)
How can I modify this code so that it displays correctly?
Thanks, Meta
whatever
unread,
Jun 21, 2012, 9:14:38 AM6/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to TiddlyWiki
Hi!
Udo has the following two examples for fET on his site:
From them, I put together the following code, which works nicely
(beware googlewrap):
<<forEachTiddler
where
'tiddler.tags.contains("booklist")'
sortBy tiddler.modified descending
script
'
function getFirstLine(s) {
var m = s.match(/\s*(.*)/);
return m != null && m.length >= 1 ? m[1] : "";
}
'
write
'(index < 10) ? "* [["+tiddler.title+"]]\n{{small
borderleft{"+getFirstLine(tiddler.text)+"}}}\n\n" : ""'
>>
HTH
w
> The problem is that tiddlywiki evidently runs the wikify command *after *all
Meta
unread,
Jun 21, 2012, 11:40:07 AM6/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tiddl...@googlegroups.com
Great, thanks, works a charm! My next challenge is to make this display in a nice table rather than a vertical list, but I think I can tackle that one.
Meta
unread,
Jun 21, 2012, 12:04:16 PM6/21/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tiddl...@googlegroups.com
This works just like I want it to:
<<forEachTiddler where 'tiddler.tags.contains("bookfile")'
sortBy tiddler.modified descending
script ' function getFirstLine(s) { var m = s.match(/\s*(.*)/); return m != null && m.length >= 1 ? m[1] : "";