You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ryan Gustafson <ry...@hotmail.com> on 2002/01/28 18:08:35 UTC

Allowing NEWLINE in #set for readability

Hello,

I'm using Velocity 1.2.  I have a #set directive that looks like the 
following (all one line):

------

#set ($sections = [ [ "This is the section body 1", "this is the section 
title 1", ["UPDATE",   "DELETE"] ], [ "This is the section body 2", "this is 
the section title 2", ["SEARCH", "RESET" ] ] ] )

------

For readability sake, I would like to represent this as:

------

#set ($sections =
   [
      [
         "This is the section body 1",
         "this is the section title 1",
         ["UPDATE", "DELETE"]
      ],
      [
         "This is the section body 2",
         "this is the section title 2",
         ["SEARCH", "RESET" ]
      ]
   ]
)

------


The parser isn't happy with the NEWLINE characters.

Is this a conscience design choice?  If so, what is the reasoning?  If not, 
would it be possible to extend the syntax to support this?

If I knew it would be accepted, I could probably find the time to make a 
patch adding this support.

Thanks,
Ryan Gustafson

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Allowing NEWLINE in #set for readability

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 1/28/02 12:08 PM, "Ryan Gustafson" <ry...@hotmail.com> wrote:

> Hello,
> 
> I'm using Velocity 1.2.  I have a #set directive that looks like the
> following (all one line):
> 
> ------
> 
> #set ($sections = [ [ "This is the section body 1", "this is the section
> title 1", ["UPDATE",   "DELETE"] ], [ "This is the section body 2", "this is
> the section title 2", ["SEARCH", "RESET" ] ] ] )
> 
> ------
> 
> For readability sake, I would like to represent this as:
> 
> ------
> 
> #set ($sections =
>  [
>     [
>        "This is the section body 1",
>        "this is the section title 1",
>        ["UPDATE", "DELETE"]
>     ],
>     [
>        "This is the section body 2",
>        "this is the section title 2",
>        ["SEARCH", "RESET" ]
>     ]
>  ]
> )
> 
> ------
> 
> 
> The parser isn't happy with the NEWLINE characters.
> 

Indeed :)

> Is this a conscience design choice?  If so, what is the reasoning?  If not,
> would it be possible to extend the syntax to support this?

Possible.
 
> If I knew it would be accepted, I could probably find the time to make a
> patch adding this support.

I already have code that does this at least for strings - it was just a
matter of deciding what we want to do.

IIRC, the general consensus was not to bother re strings, but this is a new
and interesting riff on the idea.

-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
Be a giant.  Take giant steps.  Do giant things...


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>