You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Brad Eisan <br...@5star-network.com> on 2005/01/20 14:51:13 UTC

Comments in Velocity maps ..

Hello,

I have a quick question regarding maps and nesting comments in them.

I have a map as follows:

#set( $foo = {
"1" : "Baz",
"2" : "Bat",
"3" : "Bar"
})

When I change it to have comment(s) nested within:

#set( $foo = {
## Products
"1" : "Baz",
"2" : "Bat",
"3" : "Bar"
})

I get a Parser Exception with the explanation "Encountered "\n" at line 
2, column 12."

This same error occurs where ever the comment is placed (beside a 
key-value pair, the first line, etc.). Does anyone know if there is a 
way to nest comments in a Velocity map?

Thanks,
Brad


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


Re: Comments in Velocity maps ..

Posted by Shinobu Kawai Yoshida <sh...@gmail.com>.
Hi Brad,

> I have a quick question regarding maps and nesting comments in them.
> 
> I have a map as follows:
> 
> #set( $foo = {
> "1" : "Baz",
> "2" : "Bat",
> "3" : "Bar"
> })
> 
> When I change it to have comment(s) nested within:
> 
> #set( $foo = {
> ## Products
> "1" : "Baz",
> "2" : "Bat",
> "3" : "Bar"
> })
> 
> I get a Parser Exception with the explanation "Encountered "\n" at line
> 2, column 12."
> 
> This same error occurs where ever the comment is placed (beside a
> key-value pair, the first line, etc.). Does anyone know if there is a
> way to nest comments in a Velocity map?

Unfortunately, Velocity currently doesn't support comments here.  It
only supports comments in the non-VTL context.
For now, your solution could be to place the comment before the whole lot.

## Products
#set( $foo = {
"1" : "Baz",
"2" : "Bat",
"3" : "Bar"
})

Best regards,
-- Shinobu

--
Shinobu "Kawai" Yoshida <sh...@gmail.com>

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