You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by veerabahu subramanian <ve...@gmail.com> on 2009/03/11 05:19:18 UTC

Re: Is there any way to print a block of text without any rendering in Velocity template?

bluejoe,

Give the text as such in the template file, velocity will render it exactly
as it is (when there is no directive in that text). IMO, the template file
should be as follows for you need
 hello, $user.name!

This text is formatted
  exactly
     as
        it
     is
  typed.

Let me know if this doesn't solves your problem !!

-Veerabahu
On Wed, Mar 11, 2009 at 8:50 AM, bluejoe <bl...@sdb.cnic.cn> wrote:

> In Velocity template, is there any way to print a block of text without any
> rendering? For exmaple, I want to process such text as below:
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>  hello, $user.name!
>
>  #noparse
>
> This text is formatted
>   exactly
>      as
>         it
>      is
>   typed.
>
>   using $user.name to get current user's name.
>
>  #end
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> when be rendered, I expect it looks like:
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>  hello, bluejoe!
>
> This text is formatted
>   exactly
>      as
>         it
>      is
>   typed.
>
>   using $user.name to get current user's name.
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> Is there any directives in VTL? I need your help.

Re: Is there any way to print a block of text without any rendering in Velocity template?

Posted by jian chen <ch...@gmail.com>.
You can escape the directives, i.e., the # signs.

Jian

On Tue, Mar 10, 2009 at 8:42 PM, bluejoe <bl...@sdb.cnic.cn> wrote:

> Thank you for your reply!
> There are some directives and references in the text, so I want to know how
> to let the Velocity template parser ignore them without any parsing.
>
> -bluejoe
>
> ----- Original Message -----
> From: "veerabahu subramanian" <ve...@gmail.com>
> To: "Velocity Users List" <us...@velocity.apache.org>
> Sent: Wednesday, March 11, 2009 12:19 PM
> Subject: Re: Is there any way to print a block of text without any
> rendering in Velocity template?
>
>
> > bluejoe,
> >
> > Give the text as such in the template file, velocity will render it
> exactly
> > as it is (when there is no directive in that text). IMO, the template
> file
> > should be as follows for you need
> > hello, $user.name!
> >
> > This text is formatted
> >  exactly
> >     as
> >        it
> >     is
> >  typed.
> >
> > Let me know if this doesn't solves your problem !!
> >
> > -Veerabahu
> > On Wed, Mar 11, 2009 at 8:50 AM, bluejoe <bl...@sdb.cnic.cn> wrote:
> >
> >> In Velocity template, is there any way to print a block of text without
> any
> >> rendering? For exmaple, I want to process such text as below:
> >>
> >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >>  hello, $user.name!
> >>
> >>  #noparse
> >>
> >> This text is formatted
> >>   exactly
> >>      as
> >>         it
> >>      is
> >>   typed.
> >>
> >>   using $user.name to get current user's name.
> >>
> >>  #end
> >> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>
> >> when be rendered, I expect it looks like:
> >>
> >> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> >>  hello, bluejoe!
> >>
> >> This text is formatted
> >>   exactly
> >>      as
> >>         it
> >>      is
> >>   typed.
> >>
> >>   using $user.name to get current user's name.
> >>
> >> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> >>
> >> Is there any directives in VTL? I need your help.
> >
>

Re: Is there any way to print a block of text without any rendering in Velocity template?

Posted by bluejoe <bl...@sdb.cnic.cn>.
Thank you for your reply!
There are some directives and references in the text, so I want to know how to let the Velocity template parser ignore them without any parsing.

-bluejoe

----- Original Message ----- 
From: "veerabahu subramanian" <ve...@gmail.com>
To: "Velocity Users List" <us...@velocity.apache.org>
Sent: Wednesday, March 11, 2009 12:19 PM
Subject: Re: Is there any way to print a block of text without any rendering in Velocity template?


> bluejoe,
> 
> Give the text as such in the template file, velocity will render it exactly
> as it is (when there is no directive in that text). IMO, the template file
> should be as follows for you need
> hello, $user.name!
> 
> This text is formatted
>  exactly
>     as
>        it
>     is
>  typed.
> 
> Let me know if this doesn't solves your problem !!
> 
> -Veerabahu
> On Wed, Mar 11, 2009 at 8:50 AM, bluejoe <bl...@sdb.cnic.cn> wrote:
> 
>> In Velocity template, is there any way to print a block of text without any
>> rendering? For exmaple, I want to process such text as below:
>>
>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>  hello, $user.name!
>>
>>  #noparse
>>
>> This text is formatted
>>   exactly
>>      as
>>         it
>>      is
>>   typed.
>>
>>   using $user.name to get current user's name.
>>
>>  #end
>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
>> when be rendered, I expect it looks like:
>>
>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>  hello, bluejoe!
>>
>> This text is formatted
>>   exactly
>>      as
>>         it
>>      is
>>   typed.
>>
>>   using $user.name to get current user's name.
>>
>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
>> Is there any directives in VTL? I need your help.
>