jcastura 01/01/09 19:09:17
Modified: xdocs user-guide.xml vtl-reference-guide.xml
Log:
edits
Revision Changes Path
1.24 +50 -4 jakarta-velocity/xdocs/user-guide.xml
Index: user-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/user-guide.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- user-guide.xml 2000/12/13 03:59:14 1.23
+++ user-guide.xml 2001/01/10 03:09:16 1.24
@@ -1035,8 +1035,8 @@
refers must be included under TEMPLATE_ROOT. Unlike the
<vtldirective>#include</vtldirective> directive,
<vtldirective>#parse</vtldirective> will only take a single argument.
Recursion is strictly prohibited; for example, <filename>foo.vm</filename>
cannot include the directive
- <vtldirective>#parse (foo.vm)</vtldirective>, nor can it reference any other
template which contains the
- statement <vtldirective>#parse (foo.vm)</vtldirective>. VTL templates can have
<vtldirective>#parse</vtldirective>
+ <vtldirective>#parse( foo.vm )</vtldirective>, nor can it reference any other
template which contains the
+ statement <vtldirective>#parse( foo.vm )</vtldirective>. VTL templates can have
<vtldirective>#parse</vtldirective>
statements referring to templates that in turn have
<vtldirective>#parse</vtldirective> statements. By default
set to 10, the <vtl>parse_directive.maxdepth</vtl> line of the
<filename>velocity.properties</filename> allows users
to customize maximum number of <vtldirective>#parse</vtldirective> referrals
that can occur from a single
@@ -1354,7 +1354,7 @@
<p>
<source><![CDATA[
Send me
- #set( $foo = [#10 and ","a cake"] )
+ #set( $foo = ["$10 and ","a cake"] )
#foreach( $a in $foo )
$a
#end
@@ -1369,7 +1369,7 @@
<p>
<source><![CDATA[
Send me
- #set($foo = [#10 and ","a cake"])
+ #set($foo = ["$10 and ","a cake"])
#foreach ($a in $foo )$a
#end please.
]]></source>
@@ -1382,6 +1382,52 @@
</s1>
</s1>
+
+<s1 title="Advanced Features">
+
+ <s1 title="Math">
+
+ <p>
+ Velocity has a handful of built-in mathematical functions that can be used
+ in templates with the <vtldirective>set</vtldirective> directive. The following
+ equations are examples of addition, subtraction, multiplication and division,
+ respectively:
+ </p>
+
+ <p>
+ <source><![CDATA[
+ #set( $foo = $bar + 3 )
+ #set( $foo = $bar - 4 )
+ #set( $foo = $bar * 6 )
+ #set( $foo = $bar / 2 )
+ ]]></source>
+ </p>
+
+ <p>
+ When a division operation is performed, the result will be an integer. Any
remainder
+ can be obtained by using the remainder (<vtl>%</vtl>) operand.
+ </p>
+
+ <p>
+ <source><![CDATA[
+ #set( $foo = $bar % 5 )
+ ]]></source>
+ </p>
+
+ <p>
+ Only integers (...-2, -1, 0, 1, 2...) are permissible when performing
+ mathematical equations in Velocity; when a non-integer is used, it is
+ logged and a null will be returned as the output.
+ </p>
+
+ <p>
+
+ </p>
+
+ </s1>
+
+</s1>
+
</body>
1.17 +18 -14 jakarta-velocity/xdocs/vtl-reference-guide.xml
Index: vtl-reference-guide.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/vtl-reference-guide.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- vtl-reference-guide.xml 2001/01/10 02:16:15 1.16
+++ vtl-reference-guide.xml 2001/01/10 03:09:17 1.17
@@ -292,24 +292,23 @@
<strong>#parse</strong>
<p>
- The <vtldirective>#parse</vtldirective> script element allows the template
designer to import a
- local file that contains VTL. Velocity will parse the VTL and render the
template specified.
+ The <vtldirective>#parse</vtldirective> directive is for importing a local file
that contains VTL.
+ Velocity will parse the VTL and render the template specified.
<vtldirective>#parse</vtldirective>
+ takes as an argument either a single template name in double quotes or a
variable.
</p>
<p>
<source><![CDATA[
- #parse( "me.vm" )
+ #parse( "template.vm" )
+ #parse( $arg )
]]></source>
</p>
<p>
- Like the <vtldirective>#include</vtldirective> directive,
<vtldirective>#parse</vtldirective>
- can take a variable rather than a template. Any templates to which
<vtldirective>#parse</vtldirective>
- refers must be included under TEMPLATE_ROOT. Unlike the
<vtldirective>#include</vtldirective> directive,
- <vtldirective>#parse</vtldirective> will only take a single argument.
+ Any templates to which <vtldirective>#parse</vtldirective> refers must be
included under TEMPLATE_ROOT.
Recursion is strictly prohibited; for example, <filename>foo.vm</filename>
cannot include the directive
- <vtldirective>#parse (foo.vm)</vtldirective>, nor can it reference any other
template which contains the
- statement <vtldirective>#parse (foo.vm)</vtldirective>. VTL templates can have
<vtldirective>#parse</vtldirective>
+ <vtldirective>#parse( foo.vm )</vtldirective>, nor can it reference any other
template which contains the
+ statement <vtldirective>#parse( foo.vm )</vtldirective>. VTL templates can have
<vtldirective>#parse</vtldirective>
statements referring to templates that in turn have
<vtldirective>#parse</vtldirective> statements. By default
set to 10, the <vtl>parse_directive.maxdepth</vtl> line of the
<filename>velocity.properties</filename> allows users
to customize maximum number of <vtldirective>#parse</vtldirective> referrals
that can occur from a single
@@ -317,10 +316,8 @@
<filename>velocity.properties</filename> file, Velocity will set this default
to 20.)
</p>
- </p>
-
<strong>#macro</strong>
<p>
@@ -330,7 +327,7 @@
<p>
<source><![CDATA[
- #macro( vmname arg1 arg2 )
+ #macro( vmname $arg1 $arg2 )
<VM VTL code>
#end
]]></source>
@@ -341,7 +338,7 @@
</p>
<p>
- <vtl>arg1 arg2</vtl> - Arguments to the VM. A VM can have any number of
argumentss,
+ <vtl>$arg1 $arg2</vtl> - Arguments to the VM. A VM can have any number of
argumentss,
but the number used at invocation must match the number specified in the
definition.
</p>
@@ -357,7 +354,7 @@
<p>
<source><![CDATA[
- #vmname( arg1 arg2 )
+ #vmname( $arg1 $arg2 )
]]></source>
</p>
@@ -376,6 +373,13 @@
</body>
</document>
+
+
+
+
+
+
+