You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Barbara Baughman <ba...@utdallas.edu> on 2005/04/01 02:12:41 UTC

Re: help - text within { } is not rendered by the engine

I can replicate this behavior, and it looks like a bug.

If you have a "$" followed by letters (something in the context or not
in the context), followed by a {, whatever follows the { is removed
until it gets to whitespace.

So $c1{something} -> $c1{
   $c1{something  -> $c1{
   $c1{something} More text -> $c1{ More text
   $c1{something More text -> $c1{ More text

If $c1 is in the Velocity context with a value "Hello", then it is
   $c1{something} ->Hello{
   $c1{something  ->Hello{
   $c1{something More text ->Hello{ More text

Not good behavior for a templating language.

Barbara Baughman
X2157

On Thu, 31 Mar 2005, Ricardo wrote:

>
>
>
>
> Hi,I decided to post this question one more time in case this time someone has an answer to this problem. I am using velocity 1.4. I am having problems when rendering text that is enclosed within { }. Here's my velocity template:Hello $name! Welcome to Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! Welcome to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not velocity references. So, what I was expecting to get in the generated document is the following:Hello John! Welcome to Velocity!$c1{name}$c2{phone}As shown above, I am not expecting velocity to make any changes to the $c1 and $c2 lines. However, the engine is removing the text after the '{' character. Any ideas on what is wrong with my template? Thanks.
>
>
> _______________________________________________
> Join Excite! - http://www.excite.com
> The most personalized portal on the Web!
>

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


Re: help - text within { } is not rendered by the engine

Posted by Nathan Bubna <nb...@gmail.com>.
perhaps as a workaround, try 

#set( $D = '$' )
${D}c1{whatever}

<disclaimer>i didn't test it myself</disclaimer>

On Mar 31, 2005 5:19 PM, Will Glass-Husain <wg...@forio.com> wrote:
> Is that the same as this?
> http://issues.apache.org/bugzilla/show_bug.cgi?id=28528
> 
> 
> WILL
> 
> ----- Original Message -----
> From: "Barbara Baughman" <ba...@utdallas.edu>
> To: "Velocity Users List" <ve...@jakarta.apache.org>;
> <Ri...@excite.com>
> Sent: Thursday, March 31, 2005 4:12 PM
> Subject: Re: help - text within { } is not rendered by the engine
> 
> >I can replicate this behavior, and it looks like a bug.
> >
> > If you have a "$" followed by letters (something in the context or not
> > in the context), followed by a {, whatever follows the { is removed
> > until it gets to whitespace.
> >
> > So $c1{something} -> $c1{
> >   $c1{something  -> $c1{
> >   $c1{something} More text -> $c1{ More text
> >   $c1{something More text -> $c1{ More text
> >
> > If $c1 is in the Velocity context with a value "Hello", then it is
> >   $c1{something} ->Hello{
> >   $c1{something  ->Hello{
> >   $c1{something More text ->Hello{ More text
> >
> > Not good behavior for a templating language.
> >
> > Barbara Baughman
> > X2157
> >
> > On Thu, 31 Mar 2005, Ricardo wrote:
> >
> >>
> >>
> >>
> >>
> >> Hi,I decided to post this question one more time in case this time
> >> someone has an answer to this problem. I am using velocity 1.4. I am
> >> having problems when rendering text that is enclosed within { }. Here's
> >> my velocity template:Hello $name! Welcome to
> >> Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! Welcome
> >> to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not
> >> velocity references. So, what I was expecting to get in the generated
> >> document is the following:Hello John! Welcome to
> >> Velocity!$c1{name}$c2{phone}As shown above, I am not expecting velocity
> >> to make any changes to the $c1 and $c2 lines. However, the engine is
> >> removing the text after the '{' character. Any ideas on what is wrong
> >> with my template? Thanks.
> >>
> >>
> >> _______________________________________________
> >> Join Excite! - http://www.excite.com
> >> The most personalized portal on the Web!
> >>
> >
> > ---------------------------------------------------------------------
> > 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: help - text within { } is not rendered by the engine

Posted by Will Glass-Husain <wg...@forio.com>.
Is that the same as this?
http://issues.apache.org/bugzilla/show_bug.cgi?id=28528


WILL

----- Original Message ----- 
From: "Barbara Baughman" <ba...@utdallas.edu>
To: "Velocity Users List" <ve...@jakarta.apache.org>; 
<Ri...@excite.com>
Sent: Thursday, March 31, 2005 4:12 PM
Subject: Re: help - text within { } is not rendered by the engine


>I can replicate this behavior, and it looks like a bug.
>
> If you have a "$" followed by letters (something in the context or not
> in the context), followed by a {, whatever follows the { is removed
> until it gets to whitespace.
>
> So $c1{something} -> $c1{
>   $c1{something  -> $c1{
>   $c1{something} More text -> $c1{ More text
>   $c1{something More text -> $c1{ More text
>
> If $c1 is in the Velocity context with a value "Hello", then it is
>   $c1{something} ->Hello{
>   $c1{something  ->Hello{
>   $c1{something More text ->Hello{ More text
>
> Not good behavior for a templating language.
>
> Barbara Baughman
> X2157
>
> On Thu, 31 Mar 2005, Ricardo wrote:
>
>>
>>
>>
>>
>> Hi,I decided to post this question one more time in case this time 
>> someone has an answer to this problem. I am using velocity 1.4. I am 
>> having problems when rendering text that is enclosed within { }. Here's 
>> my velocity template:Hello $name! Welcome to 
>> Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! Welcome 
>> to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not 
>> velocity references. So, what I was expecting to get in the generated 
>> document is the following:Hello John! Welcome to 
>> Velocity!$c1{name}$c2{phone}As shown above, I am not expecting velocity 
>> to make any changes to the $c1 and $c2 lines. However, the engine is 
>> removing the text after the '{' character. Any ideas on what is wrong 
>> with my template? Thanks.
>>
>>
>> _______________________________________________
>> Join Excite! - http://www.excite.com
>> The most personalized portal on the Web!
>>
>
> ---------------------------------------------------------------------
> 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: help - text within { } is not rendered by the engine

Posted by Dimitrios Kolovos <ds...@gmail.com>.
The following expression will do the trick:

$c1##
{Something}

Sorry for my previous answer. Next time I ll spend more time reading the 
question :)

Dimitrios

----- Original Message ----- 
From: "Barbara Baughman" <ba...@utdallas.edu>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Friday, April 01, 2005 1:45 AM
Subject: Re: help - text within { } is not rendered by the engine


> But if $c1 is not in the context, you cannot get the following result
> using Velocity no matter the Velocity code.
>
> $c1{something}
>
> Using your idea:
> ${c1}{something} -> ${c1}{something}
>
>
>
> Barbara Baughman
> X2157
>
> On Fri, 1 Apr 2005, Dimitrios Kolovos wrote:
>
>> You can always use the formal way: ${c1}{something} to make it work.
>>
>> Dimitrios
>>
>> ----- Original Message -----
>> From: "Barbara Baughman" <ba...@utdallas.edu>
>> To: "Velocity Users List" <ve...@jakarta.apache.org>;
>> <Ri...@excite.com>
>> Sent: Friday, April 01, 2005 1:12 AM
>> Subject: Re: help - text within { } is not rendered by the engine
>>
>>
>> >I can replicate this behavior, and it looks like a bug.
>> >
>> > If you have a "$" followed by letters (something in the context or not
>> > in the context), followed by a {, whatever follows the { is removed
>> > until it gets to whitespace.
>> >
>> > So $c1{something} -> $c1{
>> >   $c1{something  -> $c1{
>> >   $c1{something} More text -> $c1{ More text
>> >   $c1{something More text -> $c1{ More text
>> >
>> > If $c1 is in the Velocity context with a value "Hello", then it is
>> >   $c1{something} ->Hello{
>> >   $c1{something  ->Hello{
>> >   $c1{something More text ->Hello{ More text
>> >
>> > Not good behavior for a templating language.
>> >
>> > Barbara Baughman
>> > X2157
>> >
>> > On Thu, 31 Mar 2005, Ricardo wrote:
>> >
>> >>
>> >>
>> >>
>> >>
>> >> Hi,I decided to post this question one more time in case this time
>> >> someone has an answer to this problem. I am using velocity 1.4. I am
>> >> having problems when rendering text that is enclosed within { }. 
>> >> Here's
>> >> my velocity template:Hello $name! Welcome to
>> >> Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! 
>> >> Welcome
>> >> to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not
>> >> velocity references. So, what I was expecting to get in the generated
>> >> document is the following:Hello John! Welcome to
>> >> Velocity!$c1{name}$c2{phone}As shown above, I am not expecting 
>> >> velocity
>> >> to make any changes to the $c1 and $c2 lines. However, the engine is
>> >> removing the text after the '{' character. Any ideas on what is wrong
>> >> with my template? Thanks.
>> >>
>> >>
>> >> _______________________________________________
>> >> Join Excite! - http://www.excite.com
>> >> The most personalized portal on the Web!
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > 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
> 


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


Re: help - text within { } is not rendered by the engine

Posted by Barbara Baughman <ba...@utdallas.edu>.
But if $c1 is not in the context, you cannot get the following result
using Velocity no matter the Velocity code.

$c1{something}

Using your idea:
${c1}{something} -> ${c1}{something}



Barbara Baughman
X2157

On Fri, 1 Apr 2005, Dimitrios Kolovos wrote:

> You can always use the formal way: ${c1}{something} to make it work.
>
> Dimitrios
>
> ----- Original Message -----
> From: "Barbara Baughman" <ba...@utdallas.edu>
> To: "Velocity Users List" <ve...@jakarta.apache.org>;
> <Ri...@excite.com>
> Sent: Friday, April 01, 2005 1:12 AM
> Subject: Re: help - text within { } is not rendered by the engine
>
>
> >I can replicate this behavior, and it looks like a bug.
> >
> > If you have a "$" followed by letters (something in the context or not
> > in the context), followed by a {, whatever follows the { is removed
> > until it gets to whitespace.
> >
> > So $c1{something} -> $c1{
> >   $c1{something  -> $c1{
> >   $c1{something} More text -> $c1{ More text
> >   $c1{something More text -> $c1{ More text
> >
> > If $c1 is in the Velocity context with a value "Hello", then it is
> >   $c1{something} ->Hello{
> >   $c1{something  ->Hello{
> >   $c1{something More text ->Hello{ More text
> >
> > Not good behavior for a templating language.
> >
> > Barbara Baughman
> > X2157
> >
> > On Thu, 31 Mar 2005, Ricardo wrote:
> >
> >>
> >>
> >>
> >>
> >> Hi,I decided to post this question one more time in case this time
> >> someone has an answer to this problem. I am using velocity 1.4. I am
> >> having problems when rendering text that is enclosed within { }. Here's
> >> my velocity template:Hello $name! Welcome to
> >> Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! Welcome
> >> to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not
> >> velocity references. So, what I was expecting to get in the generated
> >> document is the following:Hello John! Welcome to
> >> Velocity!$c1{name}$c2{phone}As shown above, I am not expecting velocity
> >> to make any changes to the $c1 and $c2 lines. However, the engine is
> >> removing the text after the '{' character. Any ideas on what is wrong
> >> with my template? Thanks.
> >>
> >>
> >> _______________________________________________
> >> Join Excite! - http://www.excite.com
> >> The most personalized portal on the Web!
> >>
> >
> > ---------------------------------------------------------------------
> > 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: help - text within { } is not rendered by the engine

Posted by Dimitrios Kolovos <ds...@gmail.com>.
You can always use the formal way: ${c1}{something} to make it work.

Dimitrios

----- Original Message ----- 
From: "Barbara Baughman" <ba...@utdallas.edu>
To: "Velocity Users List" <ve...@jakarta.apache.org>; 
<Ri...@excite.com>
Sent: Friday, April 01, 2005 1:12 AM
Subject: Re: help - text within { } is not rendered by the engine


>I can replicate this behavior, and it looks like a bug.
>
> If you have a "$" followed by letters (something in the context or not
> in the context), followed by a {, whatever follows the { is removed
> until it gets to whitespace.
>
> So $c1{something} -> $c1{
>   $c1{something  -> $c1{
>   $c1{something} More text -> $c1{ More text
>   $c1{something More text -> $c1{ More text
>
> If $c1 is in the Velocity context with a value "Hello", then it is
>   $c1{something} ->Hello{
>   $c1{something  ->Hello{
>   $c1{something More text ->Hello{ More text
>
> Not good behavior for a templating language.
>
> Barbara Baughman
> X2157
>
> On Thu, 31 Mar 2005, Ricardo wrote:
>
>>
>>
>>
>>
>> Hi,I decided to post this question one more time in case this time 
>> someone has an answer to this problem. I am using velocity 1.4. I am 
>> having problems when rendering text that is enclosed within { }. Here's 
>> my velocity template:Hello $name! Welcome to 
>> Velocity!$c1{name}$c2{phone}Here's the output I get:Hello John! Welcome 
>> to Velocity!$c1{$c2{$name is a velocity reference. $c1 and $c2 are not 
>> velocity references. So, what I was expecting to get in the generated 
>> document is the following:Hello John! Welcome to 
>> Velocity!$c1{name}$c2{phone}As shown above, I am not expecting velocity 
>> to make any changes to the $c1 and $c2 lines. However, the engine is 
>> removing the text after the '{' character. Any ideas on what is wrong 
>> with my template? Thanks.
>>
>>
>> _______________________________________________
>> Join Excite! - http://www.excite.com
>> The most personalized portal on the Web!
>>
>
> ---------------------------------------------------------------------
> 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