You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Daniel L. Rall" <dl...@finemaltcoding.com> on 2000/08/29 01:58:14 UTC
Re: cvs commit: jakarta-velocity/src/java/org/apache/velocity
Context.java Template.java Test.java TestProvider.java
TestProvider2.java output test.sh test.wm
Fair well "seal clubber", you provided endless amusement ;P
jvanzyl@locus.apache.org wrote:
>
> jvanzyl 00/08/27 16:32:10
>
> Modified: src/java/org/apache/velocity Context.java Template.java
> Test.java TestProvider.java TestProvider2.java
> output test.sh test.wm
> Log:
> - added class docs.
>
> Revision Changes Path
> 1.4 +6 -0 jakarta-velocity/src/java/org/apache/velocity/Context.java
>
> Index: Context.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Context.java,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- Context.java 2000/08/26 18:46:00 1.3
> +++ Context.java 2000/08/27 23:32:09 1.4
> @@ -56,6 +56,12 @@
>
> import java.util.*;
>
> +/**
> + *
> + *
> + * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
> + * @version $Id: Context.java,v 1.4 2000/08/27 23:32:09 jvanzyl Exp $
> + */
> public class Context
> {
> protected Hashtable context;
>
>
>
> 1.7 +13 -1 jakarta-velocity/src/java/org/apache/velocity/Template.java
>
> Index: Template.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Template.java,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- Template.java 2000/08/26 18:49:14 1.6
> +++ Template.java 2000/08/27 23:32:09 1.7
> @@ -61,14 +61,26 @@
> import org.apache.velocity.injector.*;
>
> /**
> - * Template template = new Template("test.bm");
> + * This class is used for controlling all template
> + * operations. This class uses a parser created
> + * by JavaCC to create an AST that is subsequently
> + * traversed by a ProcessVisitor. This class is in
> + * the process of changing over to use the
> + * InjectorVistor, this is part of the planned
> + * caching mechanism.
> + *
> + * Template template = new Template("test.wm");
> * Context context = new Context();
> *
> * context.put("foo", "bar");
> * context.put("customer", new Customer());
> *
> + * template.preParse();
> * template.setContext(context);
> * template.parse();
> + *
> + * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
> + * @version $Id: Template.java,v 1.7 2000/08/27 23:32:09 jvanzyl Exp $
> */
> public class Template
> {
>
>
>
> 1.8 +8 -6 jakarta-velocity/src/java/org/apache/velocity/Test.java
>
> Index: Test.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/Test.java,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -r1.7 -r1.8
> --- Test.java 2000/08/26 20:17:47 1.7
> +++ Test.java 2000/08/27 23:32:09 1.8
> @@ -57,6 +57,13 @@
> import java.util.ArrayList;
> import org.apache.velocity.runtime.*;
>
> +/**
> + * This class the testbed for Velocity. It is used to
> + * test all the directives support by Velocity.
> + *
> + * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
> + * @version $Id: Test.java,v 1.8 2000/08/27 23:32:09 jvanzyl Exp $
> + */
> public class Test
> {
> public Test(String templateFile)
> @@ -75,13 +82,8 @@
> context.put("list", al);
>
> template.preParse();
> -
> template.setContext(context);
> -
> - for (int i = 0; i < 1000; i++)
> - {
> - template.parse();
> - }
> + template.parse();
>
> // Comment out below to test the FileLoader.
> // Make sure you set Configuration.setPropertiesFile()
>
>
>
> 1.3 +6 -4 jakarta-velocity/src/java/org/apache/velocity/TestProvider.java
>
> Index: TestProvider.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/TestProvider.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- TestProvider.java 2000/08/26 18:46:00 1.2
> +++ TestProvider.java 2000/08/27 23:32:09 1.3
> @@ -57,10 +57,12 @@
> import java.util.*;
>
> /**
> - * This class is responsible for building up
> - * the context. The resultant output is created
> - * by running the template against the information
> - * in the context.
> + * This class is used by the testbed. Instances of the class
> + * are fed into the context that is set before the AST
> + * is traversed and dynamic content generated.
> + *
> + * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
> + * @version $Id: TestProvider.java,v 1.3 2000/08/27 23:32:09 jvanzyl Exp $
> */
> public class TestProvider
> {
>
>
>
> 1.3 +5 -4 jakarta-velocity/src/java/org/apache/velocity/TestProvider2.java
>
> Index: TestProvider2.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/TestProvider2.java,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- TestProvider2.java 2000/08/26 18:46:00 1.2
> +++ TestProvider2.java 2000/08/27 23:32:09 1.3
> @@ -57,10 +57,11 @@
> import java.util.*;
>
> /**
> - * This class is responsible for building up
> - * the context. The resultant output is created
> - * by running the template against the information
> - * in the context.
> + * This class is a simple subclass of TestProvider that
> + * is used for the testbed.
> + *
> + * @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
> + * @version $Id: TestProvider2.java,v 1.3 2000/08/27 23:32:09 jvanzyl Exp $
> */
> public class TestProvider2 extends TestProvider
> {
>
>
>
> 1.4 +282 -149 jakarta-velocity/src/java/org/apache/velocity/output
>
> Index: output
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/output,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- output 2000/08/25 15:35:01 1.3
> +++ output 2000/08/27 23:32:09 1.4
> @@ -1,149 +1,282 @@
> -
> -
> -$100
> -
> -
> -bar
> -bar;
> -bar.
> -bar..
> -bar/
> -
> -
> -bar\
> -bar<
> -$foo-
> -$fooo+
> -$foo-x
> -bar$
> -
> -jon
> -$iam
> -
> -function preload(imgObj,imgSrc)
> -{
> - if (document.images)
> - {
> - eval(imgObj+' = new Image()')
> - eval(imgObj+'.src = "'+imgSrc+'"')
> - }
> -}
> -
> -function changeImage(layer,imgName,imgObj)
> -{
> - if (document.images)
> - {
> - if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
> - else document.images[imgName].src = eval(imgObj+".src")
> - }
> -}
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -
> -<!-- This is an HTML comment -->
> -
> -
> -lunatic
> -
> -
> -x
> -
> -x
> -
> -
> -lunatic
> -
> -
> -lunatic
> -
> -seal clubber
> -
> -lunatic
> -
> -jason
> -
> -jason
> -
> -
> -
> -
> - This is a property that returns a boolean
> - value of true.
> -
> -
> -
> -
> -
> -
> - The expression was false because the property
> - returned a boolean value of false.
> -
> -
> -
> - This expression is always (true).
> -
> -
> -
> -Foreach with a variable.
> -
> - This is ArrayList element 1.
> - This is ArrayList element 2.
> - This is ArrayList element 3.
> - This is ArrayList element 4.
> -
> -
> -Foreach with a property.
> -
> -<table>
> - <tr>
> - <td>
> - This is first element.
> - </td>
> - </tr>
> - <tr>
> - <td>
> - This is second element.
> - </td>
> - </tr>
> -</table>
> -
> - This is the vector element 1.
> - This is the vector element 2.
> -
> -
> -Foreach with a method.
> -
> - This is ArrayList element 1.
> - This is ArrayList element 2.
> - This is ArrayList element 3.
> - This is ArrayList element 4.
> -
> -
> -$10.00
> -
> -"this is great"
> -
> -(this is also great)
> -
> -This is the #stuff and this # # #
> -is the way #to #go.
> -
> -this = that
> -
> -I am a jason.
> -$provider.get("name")
> -$provider.get("this").get("that").get().get().get()
> -
> - Yes the GPL sucks!
> +process
> + ForeachStatement
> + Block
> + Text
> + Text
> + Text
> + Variable
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + SetStatement
> + Variable
> + Variable
> + Text
> + Variable
> + Text
> + Variable
> + Text
> + Variable
> + Text
> + Variable
> + Text
> + Variable
> + Text
> + Variable
> + Variable
> + Text
> + Variable
> + Variable
> + Text
> + SetStatement
> + Variable
> + Variable
> + Text
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + IfStatement
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Property
> + SetStatement
> + Variable
> + SetStatement
> + Variable
> + SetStatement
> + Variable
> + SetStatement
> + Variable
> + SetStatement
> + Property
> + SetStatement
> + Property
> + SetStatement
> + Property
> + SetStatement
> + Property
> + SetStatement
> + SetStatement
> + SetStatement
> + SetStatement
> + IfStatement
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + IfStatement
> + Block
> + Text
> + Text
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + IfStatement
> + Block
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + ForeachStatement
> + Block
> + Text
> + Text
> + Variable
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + ForeachStatement
> + Block
> + Text
> + Text
> + Text
> + Text
> + Variable
> + Text
> + Text
> + Text
> + Text
> + ForeachStatement
> + Block
> + Text
> + Text
> + Text
> + Variable
> + Text
> + Text
> + Text
> + Text
> + Text
> + ForeachStatement
> + Block
> + Text
> + Text
> + Variable
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Text
> + Method
> + Text
> + Method
> + Method
> + ParamStatement
> + IfStatement
> + Block
> + Text
> + Text
> + Text
> + Text
> +null
>
>
>
> 1.3 +1 -1 jakarta-velocity/src/java/org/apache/velocity/test.sh
>
> Index: test.sh
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/test.sh,v
> retrieving revision 1.2
> retrieving revision 1.3
> diff -u -r1.2 -r1.3
> --- test.sh 2000/08/26 16:48:07 1.2
> +++ test.sh 2000/08/27 23:32:09 1.3
> @@ -1 +1 @@
> -jt Test.class ./compare.wm > output
> +jt Test.class ./test.wm > output
>
>
>
> 1.4 +2 -0 jakarta-velocity/src/java/org/apache/velocity/test.wm
>
> Index: test.wm
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/test.wm,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -r1.3 -r1.4
> --- test.wm 2000/08/25 15:35:01 1.3
> +++ test.wm 2000/08/27 23:32:09 1.4
> @@ -1,5 +1,7 @@
> ## This is the test bed.
>
> +this is testing for wild loose commas , ,
> +
> $100
>
> #set $foo = "bar"
>
>
>
--
Daniel Rall <dl...@finemaltcoding.com>