You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by nb...@apache.org on 2005/02/11 03:17:59 UTC
svn commit: r153316 - in jakarta/velocity-tools/trunk/xdocs/generic:
RenderTool.xml index.xml menu.xml
Author: nbubna
Date: Thu Feb 10 18:17:58 2005
New Revision: 153316
URL: http://svn.apache.org/viewcvs?view=rev&rev=153316
Log:
add xdocs for RenderTool (bugzilla #33149)
Added:
jakarta/velocity-tools/trunk/xdocs/generic/RenderTool.xml
Modified:
jakarta/velocity-tools/trunk/xdocs/generic/index.xml
jakarta/velocity-tools/trunk/xdocs/generic/menu.xml
Added: jakarta/velocity-tools/trunk/xdocs/generic/RenderTool.xml
URL: http://svn.apache.org/viewcvs/jakarta/velocity-tools/trunk/xdocs/generic/RenderTool.xml?view=auto&rev=153316
==============================================================================
--- jakarta/velocity-tools/trunk/xdocs/generic/RenderTool.xml (added)
+++ jakarta/velocity-tools/trunk/xdocs/generic/RenderTool.xml Thu Feb 10 18:17:58 2005
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+
+<document>
+
+ <properties>
+ <title>RenderTool</title>
+ <author email="shinobu.kawai@gmail.com">Shinobu Kawai</author>
+ <projectfile>xdocs/generic/menu.xml</projectfile>
+ </properties>
+
+ <body>
+
+ <section name="RenderTool Reference Documentation">
+
+ <p>This tool exposes methods to evaluate the given strings as VTL
+ (Velocity Template Language) and automatically using the current context.</p>
+
+ <toolinfo>
+ <version>@@@version@@@, @@@date@@@</version>
+ <clazz>org.apache.velocity.tools.generic.RenderTool</clazz>
+ <name>$render</name>
+ <author email="nathan@esha.com">Nathan Bubna</author>
+ <config-example><tool>
+ <key>render</key>
+ <scope>application</scope>
+ <class>org.apache.velocity.tools.generic.RenderTool</class>
+</tool></config-example>
+ </toolinfo>
+
+ <methods/>
+
+ </section>
+
+
+ <section name="eval()">
+ <method name="eval()">
+
+ <abstract>
+ Evaluates a String containing VTL using the current context, and
+ returns the result as a String.
+ </abstract>
+
+ <signature>
+ String eval(Context ctx, String vtl)
+ </signature>
+
+ <parameters>
+ <parameter name="ctx">
+ The Context to be evaluate the vtl with.
+ </parameter>
+ <parameter name="vtl">
+ The code to be evaluated.
+ </parameter>
+ </parameters>
+
+ <returns>
+ The evaluated code as a String.
+ </returns>
+
+ <description>
+ <p>Evaluates a String containing VTL using the given context, and
+ returns the result as a String. If this fails, then <code>null</code>
+ will be returned. This evaluation is not recursive.</p>
+
+<sourcecode>#set( $list = [1,2,3] )
+#set( $object = '$list' )
+#set( $method = 'size()' )
+$render.eval($ctx, "${object}.$method")</sourcecode>
+
+<p>This will produce the following output:</p>
+
+<sourcecode>3</sourcecode>
+
+ </description>
+ </method>
+ </section>
+
+ <section name="recurse()">
+ <method name="recurse()">
+
+ <abstract>
+ Recursively evaluates a String containing VTL using the
+ current context, and returns the result as a String.
+
+ </abstract>
+
+ <signature>
+ String recurse(Context ctx, String vtl)
+ </signature>
+
+ <parameters>
+ <parameter name="vtl">
+ The code to be evaluated.
+ </parameter>
+ <parameter name="ctx">
+ The Context to be evaluate the vtl with.
+ </parameter>
+ </parameters>
+
+ <returns>
+ The evaluated code as a String.
+ </returns>
+
+ <description>
+ <p>Recursively evaluates a String containing VTL using the
+ given context, and returns the result as a String. It
+ will continue to re-evaluate the output of the last
+ evaluation until an evaluation returns the same code
+ that was fed into it.</p>
+
+<sourcecode>#macro( say_hi )hello world!#end
+#set( $foo = '#say_hi()' )
+#set( $bar = '$foo' )
+$render.recurse($ctx, '$bar')</sourcecode>
+
+<p>This will produce the following output:</p>
+
+<sourcecode>hello world!</sourcecode>
+
+ </description>
+ </method>
+ </section>
+ </body>
+</document>
+
Modified: jakarta/velocity-tools/trunk/xdocs/generic/index.xml
URL: http://svn.apache.org/viewcvs/jakarta/velocity-tools/trunk/xdocs/generic/index.xml?view=diff&r1=153315&r2=153316
==============================================================================
--- jakarta/velocity-tools/trunk/xdocs/generic/index.xml (original)
+++ jakarta/velocity-tools/trunk/xdocs/generic/index.xml Thu Feb 10 18:17:58 2005
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
- $Id: index.xml,v 1.7 2004/02/18 20:23:01 nbubna Exp $
+ $Id$
-->
<document>
@@ -51,7 +51,7 @@
to let the designer specify a condition to terminate the loop,
and reuse the same list in different loops.</dd>
- <dt><a href="../javadoc/org/apache/velocity/tools/generic/RenderTool.html"><strong>RenderTool</strong></a></dt>
+ <dt><a href="RenderTool.html"><strong>RenderTool</strong></a></dt>
<dd>A tool to evaluate and render arbitrary strings of VTL (Velocity
Template Language).</dd>
</dl>
Modified: jakarta/velocity-tools/trunk/xdocs/generic/menu.xml
URL: http://svn.apache.org/viewcvs/jakarta/velocity-tools/trunk/xdocs/generic/menu.xml?view=diff&r1=153315&r2=153316
==============================================================================
--- jakarta/velocity-tools/trunk/xdocs/generic/menu.xml (original)
+++ jakarta/velocity-tools/trunk/xdocs/generic/menu.xml Thu Feb 10 18:17:58 2005
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
- $Id: menu.xml,v 1.5 2004/02/18 20:23:01 nbubna Exp $
+ $Id$
-->
<project href="index.html">
@@ -37,7 +37,7 @@
<item name="IteratorTool" href="../javadoc/org/apache/velocity/tools/generic/IteratorTool.html"/> />
<item name="MathTool" href="MathTool.html"/>
<item name="NumberTool" href="../javadoc/org/apache/velocity/tools/generic/NumberTool.html"/>
- <item name="RenderTool" href="../javadoc/org/apache/velocity/tools/generic/RenderTool.html"/>
+ <item name="RenderTool" href="RenderTool.html"/>
</menu>
<menu name="Other Subprojects">
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org