velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Chamberlain <tchamberl...@sportingnews.com>
Subject Re: Quick Escaping Question
Date Tue, 06 Nov 2001 16:54:46 GMT
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?

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
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message