When it comes to HTML pages, you can also use a single quote such as

#set($aaa =  "<a href='$url'><font color='$color'>$name<font></a>")

This is valid according to
http://www.htmlhelp.org/reference/html40/structure.html#attributes

Yes, I know, this is a limited solution but it addresses many of the cases
we
encountered. Also, you can try to define a $dq variable with the value '"'
and use
it instead.

BTW, is there a good reason why to to allow esacping the '"' and "'" chars
such as
\" and \' when the context is a #set directive (and similar cases) ?

Tal

> -----Original Message-----
> From: Warner Onstine [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 26, 2001 9:36 AM
> To: [EMAIL PROTECTED]
> Subject: Re: How to escape "in a string?
>
>
> And it strikes again =).
>
> Here was the answer I got from an earlier post:
>
> > Hi all,
> > I'm just hoping there's a better solution to this. I am trying
> to do this:
> >
> > #set ($catLink = "<a href='$linkStr'>$category.Name</a>")
> >
> > But, I don't want the href to contain single quotes, but instead double
> > quotes. I've looked through the docs and haven't found anything
> related to
> > this.
> >
> > Everything that I've tried so far has either resulted in a bad
> link or an
> > error, any help would be appreciated.
> >
> > -warner
>
> #macro ( link $name $value )<a href="$value">$name</a>#end
>
> #set ($catLink = "#link($category.Name $linkStr)")
>
> Or, if you are using Turbine, just use $link
>
> -jon
>
> -----------------
> -warner
> ----- Original Message -----
> From: "Peter Mutsaers" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 26, 2001 7:33 AM
> Subject: VTL: How to escape "in a string?
>
>
> > Hello,
> >
> > I need to do:
> > #set ($tevdatesel = "<select name="date">$tevdates.OptionList</select>")
> >
> > But obviously this causes an error since the " just before date
> > terminates the string in VTL.
> >
> > Trying the obivous, using \ to escape the string (\"date\") somehow
> > works (rather mysteriously) but cases the output to have \"date\"
> > literally, that is, the escape character is not removed.
> >
> > Is this a bug?
> >
> > Is there another (handy) way to do this, i.e. without using multiple
> > #sets to build the string in multiple steps (which would be a pain
> > #especially if one has to mix many " and ' characters in the same
> > #string).
> >
> >
> >
> > --
> > Peter Mutsaers  |  D�bendorf    | UNIX - Live free or die
> > [EMAIL PROTECTED]      |  Switzerland  | Sent via FreeBSD 4.3-stable
> >
>
>

Reply via email to