You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Mike Bridge <br...@partslink.com> on 2003/01/08 23:06:07 UTC

#set command inside non-command

I have some html in a velocity page which includes a url that looks
something
like this:

   <a href="http://www.mydomain.com/whatever.html#setupsomething.html">

When it gets parsed, I get an error that says it's expecting a parenthesis
but received "upsomething" instead.  I'm aware of a workaround for this
for the moment:

   #set($hashmark="#")
   <a
href="http://www.mydomain.com/whatever.html${hashmark}setupsomething.html">

However, it seems like this is a problem with the tokenization of that
string;
shouldn't it assume that "setupsomething" is one word, and fail on that
word?

Or is there another way around this?  I have some "trusted" users who are
entering
html with a small amount of velocity code via a web form, and I don't want
them to
get bitten by that....

Thanks,

-Mike


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: #set command inside non-command

Posted by Nathan Bubna <na...@esha.com>.
what version of velocity are you using?  it seems to me that this is
something that has come up before ( #setfoo errors ) and i think it was
fixed at some point.

Nathan Bubna
nathan@esha.com

----- Original Message -----
From: "Mike Bridge" <br...@partslink.com>
To: <ve...@jakarta.apache.org>
Sent: Wednesday, January 08, 2003 2:06 PM
Subject: #set command inside non-command


> I have some html in a velocity page which includes a url that looks
> something
> like this:
>
>    <a href="http://www.mydomain.com/whatever.html#setupsomething.html">
>
> When it gets parsed, I get an error that says it's expecting a parenthesis
> but received "upsomething" instead.  I'm aware of a workaround for this
> for the moment:
>
>    #set($hashmark="#")
>    <a
>
href="http://www.mydomain.com/whatever.html${hashmark}setupsomething.html">
>
> However, it seems like this is a problem with the tokenization of that
> string;
> shouldn't it assume that "setupsomething" is one word, and fail on that
> word?
>
> Or is there another way around this?  I have some "trusted" users who are
> entering
> html with a small amount of velocity code via a web form, and I don't want
> them to
> get bitten by that....
>
> Thanks,
>
> -Mike
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: #set command inside non-command

Posted by Andy Lee <ag...@earthlink.net>.
At 3:06 PM -0700 1/8/03, Mike Bridge wrote:
>    <a href="http://www.mydomain.com/whatever.html#setupsomething.html">
>
>When it gets parsed, I get an error that says it's expecting a 
>parenthesis but received "upsomething" instead.  I'm aware of a 
>workaround

If getting the latest Velocity doesn't work (or if you already had 
the latest version), try single quotes instead of double quotes. 
That's how I prevented the following from looking like it contains a 
comment:

#set( $PERCENT_FORMAT = '###,###,###.0' )

--Andy

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>