I tried sending this once before, but I'm not sure it made it.  Email
from the jakarta mailing lists seems spotty lately.  In any case, I sent
it to the wrong mailing list in the first place (user, not dev).  Sorry
in advance if this was already received.

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654
--- Begin Message ---
On Mon, Dec 17, 2001 at 12:54:32PM -0500, Geir Magnusson Jr. wrote:
> On 12/17/01 12:29 PM, "Lev Epshteyn" <[EMAIL PROTECTED]> wrote:

> > I couldn't find anything in the users guide for this. Is this true for
> > version 1.2?
> 
> Yep.  And 1.1 and 1.0.
> 
> It's called a Range Operator and has been there since 1.0
> 
> I just noticed it's not in the VTL guide, and it will be :0

Here is a little patch that makes note of the range operator in the VTL
guide in the #set and #foreach sections.  In addition, an "Examples"
paragraph was added to the #foreach section (which seems appropriate
given the format of the rest of the document).

Thanks,
Pete

-- 
Peter Kazmier                                 http://www.kazmier.com
PGP Fingerprint   4FE7 8DA3 D0B5 9CAA 69DC  7243 1855 BC2E 4B43 5654
Index: vtl-reference-guide.xml
===================================================================
RCS file: /home/cvspublic/jakarta-velocity/xdocs/vtl-reference-guide.xml,v
retrieving revision 1.31
diff -u -r1.31 vtl-reference-guide.xml
--- vtl-reference-guide.xml     13 Dec 2001 18:42:57 -0000      1.31
+++ vtl-reference-guide.xml     9 Jan 2002 18:31:27 -0000
@@ -142,6 +142,7 @@
       <li>Method reference: #set( $monkey.Plan = $spindoctor.weave($web)
       )</li>
       <li>Number literal: #set( $monkey.Number = 123 )</li>
+      <li>Range operator: #set( $monkey.Numbers = [1..3] )</li>
       <li>Object array: #set( $monkey.Say = ["Not", $my, "fault"] )</li>
     </ul>
 
@@ -202,7 +203,7 @@
     </p>
 
     <p>
-    <strong>#foreach(</strong> $ref1 <strong>in</strong> $ref2
+    <strong>#foreach(</strong> $ref1 <strong>in</strong> arg
     <strong>)</strong> [ statement... ] <strong>#end</strong>
     </p>
     
@@ -212,10 +213,21 @@
 
     <ul>
     <li><em>$ref1</em> - The first variable reference is the item.</li>
-    <li><em>$ref2</em> - The second variable reference is the list that
-    holds the items.</li>
+    <li><em>arg</em> - May be one of the following: a reference to a
+        list (i.e. object array, collection, or map), an array list, or
+        the range operator.</li>
     <li><em>statement</em> - What is output each time Velocity finds a
     valid item ($ref1) in the list ($ref2).</li>
+    </ul>
+
+    <p>
+    Examples:
+    </p>
+
+    <ul>
+      <li>Reference: #foreach ( $item in $items )</li>
+      <li>Array list: #foreach ( $item in ["Not", $my, "fault"] )</li>
+      <li>Range operator: #foreach ( $item in [1..3] )</li>
     </ul>
 
     <p>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--- End Message ---
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to