You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Greg Wolfe <gr...@mypointscorp.com> on 2005/01/24 22:29:35 UTC

multi-line directives (again)

Hi,

I'm trying to get multi-line directives to work in velocity.

Is see the following post from 2002:
   http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095

It looks like this feature never made it into velocity.

Why can't I do:

#set( $array =
   "foo",
   "bar",
   "blah" )

or

#set( $notSupported1 = "spanning multiple\
lines")

Is there an approved workaround?
The (ugly) workaround I've been using for now allows me to
break string constants accross multiple lines by embedding velocity
comments and backslashes into them.

Some examples of this:

#set( $sample1 = "the great spa##\
nner")    ## note that this line must start on the first column of the file!

or

#set( $sample2 = "I span #*\
  *#wide spaces")   ## note that the whitespace was in a comment

or
#set( $sample3 = "I span #*\
    in a comment here\
  *#wider spaces")


Thanks,
-Greg Wolfe

Re: multi-line directives (again)

Posted by Will Glass-Husain <wg...@forio.com>.
This is in the upcoming v1.5.  (not the released 1.4)

The docs on the web site apply to the current source control head.  You can
download this with subversion.
http://www.apache.org/dev/version-control.html

WILL

----- Original Message ----- 
From: "Ben" <ne...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Monday, January 24, 2005 3:23 PM
Subject: Re: multi-line directives (again)


> Hi
>
> Is it just me or declaring a Map variable isn't working?
>
> #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) ## Map
>
> Gives me syntax error.
>
> -Ben
>
> On Mon, 24 Jan 2005 14:02:23 -0800, Will Glass-Husain <wg...@forio.com>
> wrote:
>> and for the other example, try
>>
>> #set( $notSupported1 = "spanning multiple" +
>>                                      " lines")
>>
>> WILL
>>
>> ----- Original Message -----
>> From: "Greg Wolfe" <gr...@mypointscorp.com>
>> To: <ve...@jakarta.apache.org>
>> Sent: Monday, January 24, 2005 1:29 PM
>> Subject: multi-line directives (again)
>>
>> Hi,
>>
>> I'm trying to get multi-line directives to work in velocity.
>>
>> Is see the following post from 2002:
>>
>> http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095
>>
>> It looks like this feature never made it into velocity.
>>
>> Why can't I do:
>>
>> #set( $array =
>>    "foo",
>>    "bar",
>>    "blah" )
>>
>> or
>>
>> #set( $notSupported1 = "spanning multiple\
>> lines")
>>
>> Is there an approved workaround?
>> The (ugly) workaround I've been using for now allows me to
>> break string constants accross multiple lines by embedding velocity
>> comments and backslashes into them.
>>
>> Some examples of this:
>>
>> #set( $sample1 = "the great spa##\
>> nner")    ## note that this line must start on the first column of the
>> file!
>>
>> or
>>
>> #set( $sample2 = "I span #*\
>>   *#wide spaces")   ## note that the whitespace was in a comment
>>
>> or
>> #set( $sample3 = "I span #*\
>>     in a comment here\
>>   *#wider spaces")
>>
>> Thanks,
>> -Greg Wolfe
>>
>> ---------------------------------------------------------------------
>> 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: multi-line directives (again)

Posted by Will Glass-Husain <wg...@forio.com>.
Use the docs that came with Velocity 1.4 to see the actual features for
that version.  Although the major differences at this point are the 
multi-line
directives and the maps.

WILL

----- Original Message ----- 
From: "Ben" <ne...@gmail.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Monday, January 24, 2005 3:23 PM
Subject: Re: multi-line directives (again)


> Hi
>
> Is it just me or declaring a Map variable isn't working?
>
> #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) ## Map
>
> Gives me syntax error.
>
> -Ben
>
> On Mon, 24 Jan 2005 14:02:23 -0800, Will Glass-Husain <wg...@forio.com>
> wrote:
>> and for the other example, try
>>
>> #set( $notSupported1 = "spanning multiple" +
>>                                      " lines")
>>
>> WILL
>>
>> ----- Original Message -----
>> From: "Greg Wolfe" <gr...@mypointscorp.com>
>> To: <ve...@jakarta.apache.org>
>> Sent: Monday, January 24, 2005 1:29 PM
>> Subject: multi-line directives (again)
>>
>> Hi,
>>
>> I'm trying to get multi-line directives to work in velocity.
>>
>> Is see the following post from 2002:
>>
>> http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095
>>
>> It looks like this feature never made it into velocity.
>>
>> Why can't I do:
>>
>> #set( $array =
>>    "foo",
>>    "bar",
>>    "blah" )
>>
>> or
>>
>> #set( $notSupported1 = "spanning multiple\
>> lines")
>>
>> Is there an approved workaround?
>> The (ugly) workaround I've been using for now allows me to
>> break string constants accross multiple lines by embedding velocity
>> comments and backslashes into them.
>>
>> Some examples of this:
>>
>> #set( $sample1 = "the great spa##\
>> nner")    ## note that this line must start on the first column of the
>> file!
>>
>> or
>>
>> #set( $sample2 = "I span #*\
>>   *#wide spaces")   ## note that the whitespace was in a comment
>>
>> or
>> #set( $sample3 = "I span #*\
>>     in a comment here\
>>   *#wider spaces")
>>
>> Thanks,
>> -Greg Wolfe
>>
>> ---------------------------------------------------------------------
>> 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: multi-line directives (again)

Posted by Ben <ne...@gmail.com>.
Hi

Is it just me or declaring a Map variable isn't working?

#set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) ## Map

Gives me syntax error.

-Ben

On Mon, 24 Jan 2005 14:02:23 -0800, Will Glass-Husain <wg...@forio.com> wrote:
> and for the other example, try
> 
> #set( $notSupported1 = "spanning multiple" +
>                                      " lines")
> 
> WILL
> 
> ----- Original Message -----
> From: "Greg Wolfe" <gr...@mypointscorp.com>
> To: <ve...@jakarta.apache.org>
> Sent: Monday, January 24, 2005 1:29 PM
> Subject: multi-line directives (again)
> 
> Hi,
> 
> I'm trying to get multi-line directives to work in velocity.
> 
> Is see the following post from 2002:
>    http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095
> 
> It looks like this feature never made it into velocity.
> 
> Why can't I do:
> 
> #set( $array =
>    "foo",
>    "bar",
>    "blah" )
> 
> or
> 
> #set( $notSupported1 = "spanning multiple\
> lines")
> 
> Is there an approved workaround?
> The (ugly) workaround I've been using for now allows me to
> break string constants accross multiple lines by embedding velocity
> comments and backslashes into them.
> 
> Some examples of this:
> 
> #set( $sample1 = "the great spa##\
> nner")    ## note that this line must start on the first column of the file!
> 
> or
> 
> #set( $sample2 = "I span #*\
>   *#wide spaces")   ## note that the whitespace was in a comment
> 
> or
> #set( $sample3 = "I span #*\
>     in a comment here\
>   *#wider spaces")
> 
> Thanks,
> -Greg Wolfe
> 
> ---------------------------------------------------------------------
> 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: multi-line directives (again)

Posted by Will Glass-Husain <wg...@forio.com>.
and for the other example, try

#set( $notSupported1 = "spanning multiple" +
                                     " lines")

WILL

----- Original Message ----- 
From: "Greg Wolfe" <gr...@mypointscorp.com>
To: <ve...@jakarta.apache.org>
Sent: Monday, January 24, 2005 1:29 PM
Subject: multi-line directives (again)



Hi,

I'm trying to get multi-line directives to work in velocity.

Is see the following post from 2002:
   http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095

It looks like this feature never made it into velocity.

Why can't I do:

#set( $array =
   "foo",
   "bar",
   "blah" )

or

#set( $notSupported1 = "spanning multiple\
lines")

Is there an approved workaround?
The (ugly) workaround I've been using for now allows me to
break string constants accross multiple lines by embedding velocity
comments and backslashes into them.

Some examples of this:

#set( $sample1 = "the great spa##\
nner")    ## note that this line must start on the first column of the file!

or

#set( $sample2 = "I span #*\
  *#wide spaces")   ## note that the whitespace was in a comment

or
#set( $sample3 = "I span #*\
    in a comment here\
  *#wider spaces")


Thanks,
-Greg Wolfe


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


Re: multi-line directives (again)

Posted by Will Glass-Husain <wg...@forio.com>.
You've got some bad syntax.

Try

#set( $array =
   ["foo",
   "bar",
   "blah"] )

This works with the latest version from the source code server.  Anyone 
tried this with 1.4?

WILL


----- Original Message ----- 
From: "Greg Wolfe" <gr...@mypointscorp.com>
To: <ve...@jakarta.apache.org>
Sent: Monday, January 24, 2005 1:29 PM
Subject: multi-line directives (again)



Hi,

I'm trying to get multi-line directives to work in velocity.

Is see the following post from 2002:
   http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=velocity-user@jakarta.apache.org&msgNo=7095

It looks like this feature never made it into velocity.

Why can't I do:

#set( $array =
   "foo",
   "bar",
   "blah" )

or

#set( $notSupported1 = "spanning multiple\
lines")

Is there an approved workaround?
The (ugly) workaround I've been using for now allows me to
break string constants accross multiple lines by embedding velocity
comments and backslashes into them.

Some examples of this:

#set( $sample1 = "the great spa##\
nner")    ## note that this line must start on the first column of the file!

or

#set( $sample2 = "I span #*\
  *#wide spaces")   ## note that the whitespace was in a comment

or
#set( $sample3 = "I span #*\
    in a comment here\
  *#wider spaces")


Thanks,
-Greg Wolfe


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