velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r485869 - in /velocity/tools/trunk/examples/showcase: alternator.vm context.vm cookies.vm date.vm esc.vm link.vm lists.vm render.vm
Date Mon, 11 Dec 2006 20:49:49 GMT
Author: nbubna
Date: Mon Dec 11 12:49:48 2006
New Revision: 485869

URL: http://svn.apache.org/viewvc?view=rev&rev=485869
Log:
add more 'full demo's to showcase pages

Modified:
    velocity/tools/trunk/examples/showcase/alternator.vm
    velocity/tools/trunk/examples/showcase/context.vm
    velocity/tools/trunk/examples/showcase/cookies.vm
    velocity/tools/trunk/examples/showcase/date.vm
    velocity/tools/trunk/examples/showcase/esc.vm
    velocity/tools/trunk/examples/showcase/link.vm
    velocity/tools/trunk/examples/showcase/lists.vm
    velocity/tools/trunk/examples/showcase/render.vm

Modified: velocity/tools/trunk/examples/showcase/alternator.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/alternator.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/alternator.vm (original)
+++ velocity/tools/trunk/examples/showcase/alternator.vm Mon Dec 11 12:49:48 2006
@@ -51,7 +51,7 @@
 
 <div align="center">
   <a name="fullDemo"><h3>Example Display</h3></a>
-<form method="post" action="$link.self">
+<form method="post" action="$link.self.anchor('fullDemo')">
 <textarea name="demo" rows="6" cols="65">##
 #if( $params.demo )##
 $params.demo##

Modified: velocity/tools/trunk/examples/showcase/context.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/context.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/context.vm (original)
+++ velocity/tools/trunk/examples/showcase/context.vm Mon Dec 11 12:49:48 2006
@@ -41,3 +41,30 @@
 
 #demoCustom( 'context' )
 </table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="6" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.h}foreach( ${esc.d}key in ${esc.d}context.keys )
+  ${esc.d}key = ${esc.d}context.get(${esc.d}key)
+${esc.h}end##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/cookies.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/cookies.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/cookies.vm (original)
+++ velocity/tools/trunk/examples/showcase/cookies.vm Mon Dec 11 12:49:48 2006
@@ -44,3 +44,30 @@
 
 #demoCustom( 'cookies' )
 </table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="3" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.h}foreach( ${esc.d}cookie in ${esc.d}cookies.all )
+  ${esc.d}cookie.name = ${esc.d}cookie.value
+${esc.h}end##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/date.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/date.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/date.vm (original)
+++ velocity/tools/trunk/examples/showcase/date.vm Mon Dec 11 12:49:48 2006
@@ -87,3 +87,35 @@
 
 #demoCustom( 'date' )
 </table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="8" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.h}${esc.h} Examples of formatting the "current" date:
+ ${esc.d}date
+ ${esc.d}date.long
+ ${esc.d}date.medium_time
+ ${esc.d}date.full_date
+ ${esc.d}date.yyyy
+ ${esc.d}date.get('default','short')
+ ${esc.d}date.get('yyyy-M-d H:m:s')##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/esc.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/esc.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/esc.vm (original)
+++ velocity/tools/trunk/examples/showcase/esc.vm Mon Dec 11 12:49:48 2006
@@ -74,3 +74,65 @@
 
 #demoCustom( 'esc' )
 </table>
+
+#set( $java = "He didn't say, ${esc.q}Stop!${esc.q}" )
+#set( $javascript = $java )
+#set( $html = '<bread> & <butter>' )
+#set( $xml = $html )
+#set( $sql = "McHale's Navy" )
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="10" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.d}java
+${esc.d}esc.java(${esc.d}java)
+
+${esc.d}javascript
+${esc.d}esc.javascript(${esc.d}javascript)
+
+${esc.d}html
+${esc.d}esc.html(${esc.d}html)
+
+${esc.d}xml
+${esc.d}esc.xml(${esc.d}xml)
+
+${esc.d}sql
+${esc.d}esc.sql(${esc.d}sql)
+
+${esc.d}esc.dollar
+${esc.d}esc.d
+
+${esc.d}esc.hash
+${esc.d}esc.h
+
+${esc.d}esc.backslash
+${esc.d}esc.b
+
+${esc.d}esc.quote
+${esc.d}esc.q
+
+${esc.d}esc.singleQuote
+${esc.d}esc.s
+
+${esc.d}esc.exclamation
+${esc.d}esc.e##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/link.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/link.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/link.vm (original)
+++ velocity/tools/trunk/examples/showcase/link.vm Mon Dec 11 12:49:48 2006
@@ -89,3 +89,34 @@
 
 #demoCustom( 'link' )
 </table>
+
+#set( $base = $link.self.anchor('fullDemo') )
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="5" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+## NOTE: this first line is done in the actual page,
+##       because #set() doesn't work in these demos
+${esc.h}set( ${esc.d}base = ${esc.d}link.self.anchor('fullDemo') )
+<a href="${esc.d}base.param('select','this')">this</a>
+<a href="${esc.d}base.param('select','that')">that</a>##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/lists.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/lists.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/lists.vm (original)
+++ velocity/tools/trunk/examples/showcase/lists.vm Mon Dec 11 12:49:48 2006
@@ -47,3 +47,35 @@
 
 #demoCustom( 'lists' )
 </table>
+
+#set( $primes = [1, 2, 3, 5, 7, 11] )
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="7" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.d}primes
+${esc.d}lists.size(${esc.d}primes)
+${esc.d}lists.get(${esc.d}primes, 2)
+${esc.d}lists.set(${esc.d}primes, 2, 1)
+${esc.d}lists.get(${esc.d}primes, 2)
+${esc.d}lists.isEmpty(${esc.d}primes)
+${esc.d}lists.contains(${esc.d}primes, 7)##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>

Modified: velocity/tools/trunk/examples/showcase/render.vm
URL: http://svn.apache.org/viewvc/velocity/tools/trunk/examples/showcase/render.vm?view=diff&rev=485869&r1=485868&r2=485869
==============================================================================
--- velocity/tools/trunk/examples/showcase/render.vm (original)
+++ velocity/tools/trunk/examples/showcase/render.vm Mon Dec 11 12:49:48 2006
@@ -30,3 +30,38 @@
 
 #demoCustom( 'render' )
 </table>
+
+<div align="center">
+  <a name="fullDemo"><h3>Example Display</h3></a>
+<form method="post" action="$link.self.anchor('fullDemo')">
+<textarea name="demo" rows="7" cols="65">##
+#if( $params.demo )##
+$params.demo##
+#else##
+${esc.h}${esc.h}Example of eval():
+${esc.h}set( ${esc.d}list = [1,2,3] )
+${esc.h}set( ${esc.d}object = '${esc.d}list' )
+${esc.h}set( ${esc.d}method = 'size()' )
+${esc.d}render.eval("${esc.d}{object}.${esc.d}method")
+
+${esc.h}${esc.h}Example of recurse():
+${esc.h}macro( say_hi )hello world!${esc.h}end
+${esc.h}set( ${esc.d}foo = '${esc.h}say_hi()' )
+${esc.h}set( ${esc.d}bar = '${esc.d}foo' )
+${esc.d}render.recurse('${esc.d}bar')##
+#end##
+</textarea>
+  <br>
+  <input type="submit" value="Try it!">
+  #if( $params.layout )
+  <input type="hidden" name="layout" value="$params.layout">
+  #end
+</form>
+
+#if( $params.demo )
+Your code returned the following results:
+<pre>
+  $render.eval($params.demo)
+</pre>
+#end
+</div>



Mime
View raw message