velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wgl...@apache.org
Subject svn commit: r522766 - in /velocity/engine/trunk/xdocs/docs: user-guide.xml vtl-reference-guide.xml
Date Tue, 27 Mar 2007 05:47:08 GMT
Author: wglass
Date: Mon Mar 26 22:47:07 2007
New Revision: 522766

URL: http://svn.apache.org/viewvc?view=rev&rev=522766
Log:
added docs for #evaluate

Modified:
    velocity/engine/trunk/xdocs/docs/user-guide.xml
    velocity/engine/trunk/xdocs/docs/vtl-reference-guide.xml

Modified: velocity/engine/trunk/xdocs/docs/user-guide.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/xdocs/docs/user-guide.xml?view=diff&rev=522766&r1=522765&r2=522766
==============================================================================
--- velocity/engine/trunk/xdocs/docs/user-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/user-guide.xml Mon Mar 26 22:47:07 2007
@@ -71,6 +71,7 @@
         <li><a href="#include">Include</a></li>
         <li><a href="#parse">Parse</a></li>
         <li><a href="#stop">Stop</a></li>
+        <li><a href="#evaluate">Evaluate</a></li>
         <li><a href="#velocimacros">Velocimacros</a></li>
     </ol>
 </li>
@@ -1487,9 +1488,27 @@
     for debugging purposes.
     </p>
 
+ </section>
+
+<section name="Evaluate" href="evaluate">
+
+    <p>
+    The <em>#evaluate</em> directive can be used to dynamically evaluate VTL.
 This allows
+    the template to evaluate a string that is created at render time.  Such a string might
be
+    used to internationalize the template or to include parts of a template from a database.
   
+    </p>
+
+    <p>The example below will display <code>abc</code>.  
+    </p>
+
 <source><![CDATA[
-#stop
+#set($source1 = "abc")
+#set($select = "1")
+#set($dynamicsource = "$source$select")
+#evaluate($dynamicsource)
 ]]></source>
+
+ 
  </section>
 
 <section name="Velocimacros" href="velocimacros">

Modified: velocity/engine/trunk/xdocs/docs/vtl-reference-guide.xml
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/xdocs/docs/vtl-reference-guide.xml?view=diff&rev=522766&r1=522765&r2=522766
==============================================================================
--- velocity/engine/trunk/xdocs/docs/vtl-reference-guide.xml (original)
+++ velocity/engine/trunk/xdocs/docs/vtl-reference-guide.xml Mon Mar 26 22:47:07 2007
@@ -176,7 +176,7 @@
     </ul>
   </subsection>
 
-  <subsection name="#if/#elseif/#else-outputconditionalontruthofstatements">
+  <subsection name="#if/#elseif/#else - Output conditional on truth of statements">
     <p>
     Format:
     </p>
@@ -267,15 +267,15 @@
 
    <p>Notes:</p>
    <ol>
-	<li>
-		The == operator can be used to compare numbers, strings, objects of the same class, or
objects
-		of different classes.  In the last case (when objects are of different classes), the toString()
-		method is called on each object and the resulting Strings are compared.
-	</li>
-	<li>
-	 You can also use brackets to delimit directives.  This is especially
+  <li>
+    The == operator can be used to compare numbers, strings, objects of the same class, or
objects
+    of different classes.  In the last case (when objects are of different classes), the
toString()
+    method is called on each object and the resulting Strings are compared.
+  </li>
+  <li>
+   You can also use brackets to delimit directives.  This is especially
     useful when text immediately follows an <code>#else</code> directive.
-	</li>
+  </li>
    </ol>
 
 <source><![CDATA[
@@ -439,6 +439,29 @@
     This will stop execution of the current template. This is good for
     debugging a template.
     </p>
+  </subsection>
+
+  <subsection name="#evaluate - Dynamically evaluates a string or reference" href="evaluate">
+    <p>
+    Format:
+    </p>
+
+    <p>
+    <strong>#</strong> [ <strong>{</strong> ] <strong>evaluate</strong>
[ <strong>}</strong> ] <strong>( </strong>arg<strong> )</strong>
+    </p>
+
+    <ul>
+    <li><em>arg</em> - String literal or reference to be dynamically evaluated.</li>
+    </ul>
+
+    <p>
+    Examples:
+    </p>
+
+    <ul>
+      <li>String: #evaluate( 'string with VTL #if(true)will be displayed#end' )</li>
+      <li>Variable: #include( $foo )</li>
+    </ul>
   </subsection>
 
   <subsection name="#macro - Allows users to define a Velocimacro (VM), a repeated segment
of a VTL template, as required" href="macro-AllowsuserstodefineaVelocimacro(VM),arepeatedsegmentofaVTLtemplate,asrequired">



Mime
View raw message