You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by dizzi <di...@logout.sh.cvut.cz> on 2006/08/04 11:13:11 UTC

some escape character

It has probably pretty simple solution but i cant figure it anyway :)

#macro(button $name $url)
	<div class="button"><a href="$url">$name</a></div>
#end


#set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
#button("ADD" "javascript:retrieveURL($AJAXurl)")<br>

is renedered like "javascript:retrieveURL(/tors/ShowRegionAddForm.do)"

I need "javascript:retrieveURL("/tors/ShowRegionAddForm.do")"

How can i tell velocity that quote in macro parameter is part of string  
and not argument


#button("ADD" "javascript:retrieveURL('$AJAXurl')")<br>

this works nice, but what if i need " and not ' :)

thx dizzi

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: some escape character

Posted by Will Glass-Husain <wg...@forio.com>.
I don't think we currently allow this.  Is it in JIRA?  If not, I'll
add it a bit later.

Will

On 8/4/06, Nathan Bubna <nb...@gmail.com> wrote:
> I can't recall if quote escaping was actually added to Velocity 1.5
> yet or not, but i'm at least sure we came to the consensus that double
> quote escaping should be done as follows for backwards compatibility.
>
> #button( "ADD" "javascript:retrieveURL(""$AJAXurl"")
>
> At least, i think so.  Perhaps someone else can confirm whether this
> is in 1.5 yet or not?  My memory is fuzzy these days, as i'm suffering
> from newborn-baby-sleep-deprivation. :)
>
> On 8/4/06, Barbara Baughman <ba...@utdallas.edu> wrote:
> > When in doubt, I find the most straightforward way to do it is to:
> > #set($q='"')
> >
> > #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> > #button("ADD" "javascript:retrieveURL($q$AJAXurl$q)")<br>
> >
> > This approach takes less brainpower to implement and is easier to read
> > than escape characters, which I don't think Velocity has anyway.  I
> > use this quite often in HTML-based templates.
> >
> > Barbara Baughman
> > X2157
> >
> > On Fri, 4 Aug 2006, dizzi wrote:
> >
> > > It has probably pretty simple solution but i cant figure it anyway :)
> > >
> > > #macro(button $name $url)
> > >       <div class="button"><a href="$url">$name</a></div>
> > > #end
> > >
> > >
> > > #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> > > #button("ADD" "javascript:retrieveURL($AJAXurl)")<br>
> > >
> > > is renedered like "javascript:retrieveURL(/tors/ShowRegionAddForm.do)"
> > >
> > > I need "javascript:retrieveURL("/tors/ShowRegionAddForm.do")"
> > >
> > > How can i tell velocity that quote in macro parameter is part of string
> > > and not argument
> > >
> > >
> > > #button("ADD" "javascript:retrieveURL('$AJAXurl')")<br>
> > >
> > > this works nice, but what if i need " and not ' :)
> > >
> > > thx dizzi
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: some escape character

Posted by Nathan Bubna <nb...@gmail.com>.
I can't recall if quote escaping was actually added to Velocity 1.5
yet or not, but i'm at least sure we came to the consensus that double
quote escaping should be done as follows for backwards compatibility.

#button( "ADD" "javascript:retrieveURL(""$AJAXurl"")

At least, i think so.  Perhaps someone else can confirm whether this
is in 1.5 yet or not?  My memory is fuzzy these days, as i'm suffering
from newborn-baby-sleep-deprivation. :)

On 8/4/06, Barbara Baughman <ba...@utdallas.edu> wrote:
> When in doubt, I find the most straightforward way to do it is to:
> #set($q='"')
>
> #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> #button("ADD" "javascript:retrieveURL($q$AJAXurl$q)")<br>
>
> This approach takes less brainpower to implement and is easier to read
> than escape characters, which I don't think Velocity has anyway.  I
> use this quite often in HTML-based templates.
>
> Barbara Baughman
> X2157
>
> On Fri, 4 Aug 2006, dizzi wrote:
>
> > It has probably pretty simple solution but i cant figure it anyway :)
> >
> > #macro(button $name $url)
> >       <div class="button"><a href="$url">$name</a></div>
> > #end
> >
> >
> > #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> > #button("ADD" "javascript:retrieveURL($AJAXurl)")<br>
> >
> > is renedered like "javascript:retrieveURL(/tors/ShowRegionAddForm.do)"
> >
> > I need "javascript:retrieveURL("/tors/ShowRegionAddForm.do")"
> >
> > How can i tell velocity that quote in macro parameter is part of string
> > and not argument
> >
> >
> > #button("ADD" "javascript:retrieveURL('$AJAXurl')")<br>
> >
> > this works nice, but what if i need " and not ' :)
> >
> > thx dizzi
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: some escape character

Posted by dizzi <di...@logout.sh.cvut.cz>.
Oh as i wrote - simple solution, thx :)

Have a nice day

On Fri, 04 Aug 2006 15:45:23 +0200, Barbara Baughman  
<ba...@utdallas.edu> wrote:

> When in doubt, I find the most straightforward way to do it is to:
> #set($q='"')
>
> #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> #button("ADD" "javascript:retrieveURL($q$AJAXurl$q)")<br>
>
> This approach takes less brainpower to implement and is easier to read
> than escape characters, which I don't think Velocity has anyway.  I
> use this quite often in HTML-based templates.
>
> Barbara Baughman
> X2157
>
> On Fri, 4 Aug 2006, dizzi wrote:
>
>> It has probably pretty simple solution but i cant figure it anyway :)
>>
>> #macro(button $name $url)
>> 	<div class="button"><a href="$url">$name</a></div>
>> #end
>>
>>
>> #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
>> #button("ADD" "javascript:retrieveURL($AJAXurl)")<br>
>>
>> is renedered like "javascript:retrieveURL(/tors/ShowRegionAddForm.do)"
>>
>> I need "javascript:retrieveURL("/tors/ShowRegionAddForm.do")"
>>
>> How can i tell velocity that quote in macro parameter is part of string
>> and not argument
>>
>>
>> #button("ADD" "javascript:retrieveURL('$AJAXurl')")<br>
>>
>> this works nice, but what if i need " and not ' :)
>>
>> thx dizzi
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: some escape character

Posted by Barbara Baughman <ba...@utdallas.edu>.
When in doubt, I find the most straightforward way to do it is to:
#set($q='"')

#set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
#button("ADD" "javascript:retrieveURL($q$AJAXurl$q)")<br>

This approach takes less brainpower to implement and is easier to read
than escape characters, which I don't think Velocity has anyway.  I
use this quite often in HTML-based templates.

Barbara Baughman
X2157

On Fri, 4 Aug 2006, dizzi wrote:

> It has probably pretty simple solution but i cant figure it anyway :)
>
> #macro(button $name $url)
> 	<div class="button"><a href="$url">$name</a></div>
> #end
>
>
> #set ($AJAXurl = $link.setAction("ShowRegionAddForm"))
> #button("ADD" "javascript:retrieveURL($AJAXurl)")<br>
>
> is renedered like "javascript:retrieveURL(/tors/ShowRegionAddForm.do)"
>
> I need "javascript:retrieveURL("/tors/ShowRegionAddForm.do")"
>
> How can i tell velocity that quote in macro parameter is part of string
> and not argument
>
>
> #button("ADD" "javascript:retrieveURL('$AJAXurl')")<br>
>
> this works nice, but what if i need " and not ' :)
>
> thx dizzi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org