> a checkbox (using the great checkbox plugin).
> <<forEachTiddler
> ...
> write " ' [X(' +tiddler.title+ ':Completed){}{}{if (!place.checked)
> return; var
> tid=store.getTiddler(story.findContainingTiddler(place).getAttribute(\"tiddler
> \"); displayMessage(tid.title); store.saveTiddler(tid.title,
> tid.title, tid.text, tid.modifier, tid.modified, tid.tags,
> tid.fields);}] [['+tiddler.title+'|'+tiddler.title+']]\n ' " >>
There are *three* kinds of quote available for use in a TW macro:
single-quote (') , double-quote ("), and double-squarebrackets
([[...]])
Although <<forEachTiddler>> is very powerful, it's also really easy to
run out of quotes, because the content of the macro's write clause is
enclosed in a set of double-quotes, and also includes single-quotes
surrounding static text that contains double-brackets [[ ]].
Given that you are already writing several bits of javascript code
within the <<forEachTiddler>> macro, perhaps it's not too much of a
stretch to switch over to writing 'pure' inline javascript rather than
do battle with the subtle combination quotes needed by the
<<forEachTiddler>> macro syntax.
For example, here's an inline script that should produce the same
results as the above <<forEachTiddler>> macro:
<script>
var tids = store.getTaggedTiddlers("Tasks");
var fn="if (place.checked) window.saveCurrentTiddler(place); \
var
tid=store.getTiddler(story.findContainingTiddler(here).getAttribute('tiddler');
\
displayMessage(tid.title); \
store.saveTiddler(tid.title,tid.title,tid.text,tid.modifier,tid.modified,tid.tags,tid.fields);";
var out="";
for (var i=0; i<tids.length; i++) {
if (tids[i].isTagged("Completed")) continue;
var t=tids[i].title;
out+=" [X("+t+":Completed){}{}{"+fn+"}] [["+t+"|"+t+"]]\n";
}
return out;
</script>
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios