Giffmex's new tiddler macro error

3 views
Skip to first unread message

Dave Gifford - http://www.giffmex.org/

unread,
Jan 11, 2008, 11:28:21 PM1/11/08
to TiddlyWiki
Hi guys

I am trying to create a new tiddler button to put in the
SideBarOptions that creates a tiddler with a foreachtiddler macro
inside it. I thought the code would look like this, but it turns up an
error. Could one of you macro-savvy tiddler-geniuses help me out?

<<newTiddler title:"Replace this title with the name of your topic"
label:"new topic" tag:"topic" text: {{"<<forEachTiddler where
'tiddler.tags.contains("Computers") && tiddler.data("notetopic")'
sortBy 'GroupTitle = tiddler.data("notetopic")
+"###"+tiddler.data("booktitle")' script 'function
getGroupTitle(tiddler, context) {if (!context.lastGroup ||
context.lastGroup != tiddler.data("notetopic")) {context.lastGroup =
tiddler.data("notetopic");return "!!{{{"+(context.lastGroup?
context.lastGroup:"no tags")+"}}}\n";} else return "";}' write
'getGroupTitle(tiddler, context)+"**[["+tiddler.title+"]]\n"'\>\>"}}>>

Thanks and blessings to you all

Dave Gifford

Eric Shulman

unread,
Jan 11, 2008, 11:52:50 PM1/11/08
to TiddlyWiki
> <<newTiddler title:"Replace this title with the name of your topic"
> label:"new topic" tag:"topic" text: {{"<<forEachTiddler where
> 'tiddler.tags.contains("Computers") && tiddler.data("notetopic")'
> sortBy 'GroupTitle = tiddler.data("notetopic")
> +"###"+tiddler.data("booktitle")' script 'function
> getGroupTitle(tiddler, context) {if (!context.lastGroup ||
> context.lastGroup != tiddler.data("notetopic")) {context.lastGroup =
> tiddler.data("notetopic");return "!!{{{"+(context.lastGroup?
> context.lastGroup:"no tags")+"}}}\n";} else return "";}' write
> 'getGroupTitle(tiddler, context)+"**[["+tiddler.title+"]]\n"'\>\>"}}>>

Nested double-quotes: the macro param itself is using double-quotes in
the {{"..."}} syntax, so you can't use them inside the
<<forEachMacro>> as well. To avoid this, instead of putting the
default text directly into the macro param, you can use this "text"
param to get the default text from another tidder (e.g.,
[[BlankTopic]])

text:{{store.getTiddlerText("BlankTopic")}}

where [[BlankTopic]] contains the desired default <<forEachTiddler>>
content, but doesn't need to have the surrounding double-quotes, so
you are free to use them within the <<forEachTiddler>> params as
usual...

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Dave Gifford - http://www.giffmex.org/

unread,
Jan 13, 2008, 8:36:01 PM1/13/08
to TiddlyWiki
Hi Eric,

Google Groups must have swallowed my reply from the other day. Your
trick worked great. Thanks!

Dave
Reply all
Reply to author
Forward
0 new messages