I want to use the forEachTiddlerPlugin [1] in a template. How do I
properly escape string literals in the javascript inserted in the
plugin?

Here's roughly what I want to achieve (as a simplified example): In
every tiddler, I want to output the title of each tiddler which starts
with the title of the current tiddler but with an exclamation mark at
the end.

What doesn't work is including the following in ViewTemplate:

<div macro ='forEachTiddler where
"tiddler.title.substring(0,context.inTiddler.title.length)==context.inTiddler.title
&& context.inTiddler.title.length < tiddler.title.length" write
"tiddler.title+\"!\"" '></div>

The problem is escaping the javscript string delimiters around the
exclamation mark, i.e. the part \"!\" in the above code.

I could of course write a plugin providing a global function (say
document.addExclamationMark = function(name) { return name+"!";};
), but that somehow seems not right.

Any help is appreciated!

Rolf

[1] http://tiddlywiki.abego-software.de/#ForEachTiddlerPlugin

-- 
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