velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Quick Escaping Question
Date Wed, 07 Nov 2001 00:16:38 GMT
On 11/6/01 11:54 AM, "Tim Chamberlain" <tchamberlain@sportingnews.com>
wrote:

> Hello again,
> 
> Im still having the same problem trying to print a #.
> I have tried to accomplish this with the following lines of code:
> 
> <td align=center class=v10><b>#</b></td>
> <td align=center class=v10><b> # </b></td>
> <td align=center class=v10><b>\#</b></td>
> 
> The first two render nothing and the third gives me a \.
> 
> The same thing happens if I replace the # with a $.  I am trying to do
> this within a #if statement within a #macro using version 1.2, if that
> makes any difference.
> Any thougths?


Yep, I see it.

Thanks.  Do the #set() workaround until I fix.  Should be quick.  Sorry
about this.

Geir
 
> Thanks again,
> Tim
> 
> Geir Magnusson Jr. wrote:
> 
>> On 11/5/01 5:02 PM, "Tim Chamberlain" <tchamberlain@sportingnews.com> wrote:
>> 
>>> Hello List,
>>> 
>>> I have a quick question about escaping characters.  In a template I am
>>> trying to output #.   If I simply type #, nothing is printed out.
>>> 
>> 
>> A # should be printed out.  What version of velocity are you using?
>> 
>>> The 
>>> manual talks about escaping $ with \$ but I did not see escaping the
>>> pound sign anywhere.  I tried the same technique with # (ie \#), but \
>>> was printed out instead of the #  I was expecting.  Is it possible to
>>> escape the pound character?
>>> 
>>> Thanks in advance,
>>> Tim
>>> 
>> 
>> You only need to escape #<token> when <token> is a valid directive, like
>> 
>> \#set
>> 
>> Similarly, only need to escape $<foo> when <foo> is something that has
a
>> value in the context.
>> 
>> Otherwise, all other cases should render 'as is'.
>> 
>> Geir
>> 
> 
> 

-- 
Geir Magnusson Jr.     geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



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


Mime
View raw message