Well the problem is the usage in a template.

If I put
<<forEachTiddlerPlugin where ... write 'tiddler.title+"!" '>>
directly into the tiddler, everything works fine (it outputs
SomeTiddler!).

But if I want to put it into a template I have another set of string
delimiters from the <div macro='...'></div> call.

But luckily julien23 solution worked, i.e. I now have
<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>

Thanks for the help!

Rolf

On Apr 11, 6:59 am, whatever <[email protected]> wrote:
> Hi!
>
> The literal text must be in double quotes and any parameters, such as
> tiddler.title, must have a plus sign if between two strings of literal
> text, including single spaces. In your case, the literal string is
> after the parameter, so only the second plus is necessary. What it
> does is basically concatenates strings, literal and/or otherwise.
>
> <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 result in your case would be SomeTiddler"!". Are the quotes around
> the exclamation mark on purpose? If not, you need to delete both
> escaped quotes (\").
>
> w
>
> On Apr 11, 7:52 am, julien23 <[email protected]> wrote:
>
> > Might be of any help
>
> >http://groups.google.com/group/tiddlywiki/browse_thread/thread/e028c2...
>
> > On 10 avr, 22:38, Rolf S <[email protected]> wrote:
>
> > > 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.inTiddl
> > >  er.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