----- Original Message -----
From: "Geir Magnusson Jr." <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, July 22, 2001 6:41 PM
Subject: Re: escaping characters
> Warner Onstine wrote:
>
> > From: "Geir Magnusson Jr." <[EMAIL PROTECTED]>
>
> > > I assume you would want to do something like :
> > >
> > > #set( $catLink = "<a href=\"$linkStr\">$category.Name</a>" )
> > >
> > > ?
> >
> > After reading the docs that was actually the second thing I tried which
> > didn't work. I think it would be a nice feature but don't know how much
> > complexity it adds to the system.
>
> Not much. It's more of a "Does VTL really need this?" issue...
>
> > > I am asking because I have been playing with this for a while, but
can't
> > > make up my mind if I like it, and therefore haven't proposed it...
> >
> > I would say if it isn't going to work that way then the user docs need
to be
> > absolutely clear on that point.
>
> :)
>
> Can you imagine how long that list would be, mentioning all the things
> that *don't* work?
>
> 1) C/Java style string escaping won't work.
> 2) You can't sing to it.
> 3) Sending flowers with a " is right out...
> 4) ...
No, I understand this, but how to escape special characters is something
that should be explained, it did take me a little while to find this:
When using the #set directive, string literals that are enclosed in double
quote characters will be parsed and rendered, as shown:
and to understand that that's why it was having a problem with href
attribute being in double quotes, so I immediately started looking for a way
to escape those characters, rather than try and think about it in a
programmatical sense. It's what I'd used before in Java and C, so I was
looking for the same solution.
Does this mean that we need to add this to VTL, I don't know. I would say
yes if there is a definite need for it. But that need can only be determined
by looking through the archives and asking the users if this is something
they had looked for and ended up working around.
> :)
>
> I'm just kidding - that's a good point.
Well what I was talking about was this line in the user's guide:
Suppose that $email is defined (for example, if it has the value foo), and
that you want to output $email. There are a few ways of doing this, but the
simplest is to use the escape character.
Maybe by adding some additionaly line here like:
Special note this does not escape anything other than variables, or
something....
-warner
> geir
>
>
> --
> Geir Magnusson Jr. [EMAIL PROTECTED]
> System and Software Consulting
> Developing for the web? See http://jakarta.apache.org/velocity/
> Be well, do good work, and keep in touch.
>