You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by jo...@apache.org on 2001/03/04 22:24:15 UTC
cvs commit: jakarta-velocity/examples/anakia/build velocity.properties
jon 01/03/04 13:24:15
Modified: docs anakia.html
src/java/org/apache/velocity/anakia AnakiaTask.java
xdocs anakia.xml
examples/anakia/build velocity.properties
Log:
Added templatePath variable to Anakia at Jason's suggetion. This allows
one to totally remove the need for a velocity.properties file if you
just want the Velocity defaults.
Added a $date object to the context for Anakia
Updated documentation
Removed extra properties from Anakia example velocity.properties.
Revision Changes Path
1.10 +162 -101 jakarta-velocity/docs/anakia.html
Index: anakia.html
===================================================================
RCS file: /home/cvs/jakarta-velocity/docs/anakia.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- anakia.html 2001/03/03 08:31:28 1.9
+++ anakia.html 2001/03/04 21:24:14 1.10
@@ -99,33 +99,45 @@
files.
</p>
<p>
- Anakia is potentially easier to learn than XSL, but it maintains
- a similar level of functionality. Learning cryptic <xsl:>
- tags is unnecessary; you only need to know how to use the
- provided Context objects, JDOM, and Velocity's simple directives. Anakia
- seems to perform much faster than Xalan's XSL processor at creating pages.
- (23 pages are generated in 7-8 seconds on a PIII 500mhz running Win98 and
- JDK 1.3 with client Hotspot. A similar system using Ant's <style> task
- took 14-15 seconds -- nearly a 2x speed improvement.)
+ Anakia is potentially easier to learn than XSL, but it maintains a
+ similar level of functionality. Learning cryptic <xsl:> tags
+ is unnecessary; you only need to know how to use the provided
+ Context objects, JDOM, and Velocity's simple directives. Anakia
+ seems to perform much faster than Xalan's XSL processor at creating
+ pages. (23 pages are generated in 7-8 seconds on a PIII 500mhz
+ running Win98 and JDK 1.3 with client Hotspot. A similar system
+ using Ant's <style> task took 14-15 seconds -- nearly a 2x
+ speed improvement.)
</p>
<p>
- Anakia -- intended to replace Stylebook, which was
- originally used to generate simple, static web sites in which all pages had
- the same look and feel -- is great for documentation/project web sites,
- such as the sites on jakarta.apache.org. As it is more targeted to a specific
- purpose, it does not provide some of XSL's "extra" functionality.
+ Anakia -- intended to replace Stylebook, which was originally used
+ to generate simple, static web sites in which all pages had the same
+ look and feel -- is great for documentation/project web sites, such
+ as the sites on jakarta.apache.org. As it is more targeted to a
+ specific purpose, it does not provide some of XSL's
+ "extra" functionality.
</p>
<p>
The example in the jakarta-velocity/examples/anakia directory
- provides a good introduction to Anakia. You should find it quite simple to use.
+ provides a good introduction to Anakia. You should find it quite
+ simple to use.
</p>
<p>
- Anakia creates a Context, which contains a JDOM Document object of the
- .xml page, as well as an (optional) JDOM Document object of your project.xml
- page. The .vsl page is executed (using Velocity) with the Context. You can then
- navigate your .xml file and pull information out of it by simply executing methods
- on the JDOM Document object.
+ Anakia creates a Context, which contains a JDOM Document object of
+ the .xml page, as well as an (optional) JDOM Document object of your
+ project.xml page. The .vsl page is executed (using Velocity) with
+ the Context. You can then navigate your .xml file and pull
+ information out of it by simply executing methods on the JDOM
+ Document object.
</p>
+ <p>
+ Anakia is being used to create the documentation for not only this
+ website, but also for the Jakarta Project's website as well as
+ many of the projects that live under the Jakarta Project. This
+ process is
+ <a href="http://jakarta.apache.org/site/jakarta-site2.html">documented</a>
+ on the site. You are welcome to use this for your own needs as well.
+</p>
</blockquote>
</td></tr>
</table>
@@ -142,20 +154,20 @@
you must <a href="install.html">build Velocity</a>.
</p>
<p>
- After building Velocity, <code>cd</code> into the jakarta-velocity/examples/anakia/build
- directory and run <code>./build.sh</code>. (Shell scripts will work on
- the Windows platform if you install <a href="http://sources.redhat.com/cygwin/">Cygwin</a>.)
+ After building Velocity, <code>cd</code> into the
+ jakarta-velocity/examples/anakia/build directory and run
+ <code>./build.sh</code>. (Shell scripts will work on the Windows
+ platform if you install <a href="http://sources.redhat.com/cygwin/">Cygwin</a>.)
</p>
<p>
- Output from the build.sh script, in this case HTML files, is placed into the
- jakarta-velocity/examples/anakia/docs/ directory.
+ Output from the build.sh script, in this case HTML files, is placed
+ into the jakarta-velocity/examples/anakia/docs/ directory.
</p>
<p>
- The jakarta-velocity/examples/anakia/xdocs/ directory has all of the .xml
- source code. The xdocs/stylesheets directory contains the
- .vsl file, in which most of the magic happens. Understanding
- <a href="user-guide.html">Velocity Template Language</a> and JDOM
- is necessary to understand how the .vsl file works.
+ The jakarta-velocity/examples/anakia/xdocs/ directory has all of the
+ .xml source code. The xdocs/stylesheets directory contains the .vsl
+ file, in which most of the magic happens. Understanding <a href="user-guide.html">Velocity Template Language</a> and JDOM is
+ necessary to understand how the .vsl file works.
</p>
</blockquote>
</td></tr>
@@ -169,8 +181,8 @@
<tr><td>
<blockquote>
<p>
- Anakia is an Ant task that executes from an Ant build file. The build file looks
- something like this:
+ Anakia is an Ant task that executes from an Ant build file. The
+ build file looks something like this:
</p>
<div align="left">
<table cellspacing="4" cellpadding="0" border="0">
@@ -253,7 +265,8 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- Specifies the path to the directory location of your .xml files.
+ Specifies the path to the directory location of your
+ .xml files.
</font>
</td>
@@ -268,7 +281,8 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- Specifies the path to the directory where the output files should go.
+ Specifies the path to the directory where the output
+ files should go.
</font>
</td>
@@ -283,9 +297,11 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the extension that is appended to the end of your .xml file. For example,
- with an extension of ".html", index.xml would be converted into index.html.
- By default, the extension is .html.
+
+ This is the extension that is appended to the end of your
+ .xml file. For example, with an extension of ".html",
+ index.xml would be converted into index.html. By default,
+ the extension is .html.
</font>
@@ -301,10 +317,10 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the path (relative to Velocity's template.loader.1.template.path)
- to the VelocityStyleTemplate to process. This file is the equivalent to the
- .xsl file in Ant's style task.
-
+ This is the path (relative to Velocity's
+ template.loader.1.template.path) to the
+ VelocityStyleTemplate to process. This file is the
+ equivalent to the .xsl file in Ant's style task.
</font>
</td>
@@ -319,15 +335,15 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the path to a "project" file. This file is an XML file
- that can be used as a "navigation" file. If you have used Stylebook
- or Struts system for generation of the web site documentation, you
- will understand the purpose of this file. If you look at the Anakia example in the
- jakarta-velocity/examples/anakia directory, you can see the project.xml
- file being used in the .vsl file.
-
- <strong>It is an optional
- task argument.</strong>
+ This is the path to a "project" file. This file is an
+ XML file that can be used as a "navigation" file. If you
+ have used Stylebook or Struts system for generation of the
+ web site documentation, you will understand the purpose of
+ this file.
+ If you look at the Anakia example in the
+ jakarta-velocity/examples/anakia directory, you can see the
+ project.xml file being used in the .vsl file.
+ <strong>It is an optional task argument.</strong>
</font>
</td>
@@ -342,8 +358,9 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the standard Ant excludes attribute. Specify any files
- or directories that you do not want Anakia to try to process.
+ This is the standard Ant excludes attribute. Specify any
+ files or directories that you do not want Anakia to try to
+ process.
</font>
</td>
@@ -358,8 +375,9 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the standard Ant includes attribute. Specify any files
- or directories that you do want Anakia to try to process.
+ This is the standard Ant includes attribute. Specify any
+ files or directories that you do want Anakia to try to
+ process.
</font>
</td>
@@ -373,14 +391,37 @@
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ This turns on or off the ability to check the last
+ modified date on files in order to determine whether or not
+ they need to be re-rendered or not. The value of this
+ attribute can be "true, false, yes, no". By default, it is
+ true, meaning that the last modified date should be checked
+ and if the original .xml file, project file, or .vsl file
+ have not changed, then don't process the page. This
+ accelerates processing because pages that have not changed
+ will not get reprocessed.
+
+ </font>
+</td>
+ </tr>
+
+ <tr>
+ <td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ templatePath
+
+ </font>
+</td>
+ <td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This turns on or off the ability to check the last modified date on files
- in order to determine whether or not they need to be re-rendered or not.
- The value of this attribute can be "true, false, yes, no". By
- default, it is true, meaning that the last modified date should be checked
- and if the original .xml file, project file, or .vsl file have not changed,
- then don't process the page. This accelerates processing because
- pages that have not changed will not get reprocessed.
+ This is the path to the templateRoot which is the
+ directory where your site.vsl file is located. This can be
+ defined in the Velocity.properties or it can be defined
+ here. It it an optional argument if it is defined in the
+ Velocity properties file already. However, if defined, this
+ value will override the path defined in the
+ Velocity.properties file.
</font>
</td>
@@ -395,9 +436,10 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This is the path to the velocity.properties file. It is an optional
- argument and by default is set to find the properties file in the same
- directory that the JVM was started in.
+ This is the path to the velocity.properties file. It is
+ an optional argument and by default is set to find the
+ properties file in the same directory that the JVM was
+ started in.
</font>
</td>
@@ -416,11 +458,12 @@
<tr><td>
<blockquote>
<p>
- The Anakia Ant task places several objects into the Context for you. Right now,
- you do not have control over what is placed into the Context. Eventually,
- we hope to have a way to give you control over this. However, that does not prevent
- Anakia from being extremely useful for you today. :-)
- The objects that are available to you in your .vsl template are:
+ The Anakia Ant task places several objects into the Context for you.
+ Right now, you do not have control over what is placed into the
+ Context. Eventually, we hope to have a way to give you control over
+ this. However, that does not prevent Anakia from being extremely
+ useful for you today. :-) The objects that are available to you in
+ your .vsl template are:
</p>
<table>
<tr>
@@ -462,10 +505,9 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This contains the JDOM root Element to your project.xml document.
- If you have not specified a project.xml document, then this variable
- will not be in the context.
-
+ This contains the JDOM root Element to your project.xml
+ document. If you have not specified a project.xml document,
+ then this variable will not be in the context.
</font>
</td>
@@ -480,11 +522,11 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This context object will convert HTML Entities in the $string
- that is passed into it and it will return the converted String. This
- is good for dealing with CDATA. The entities that are converted are:
- " -> " | < -> < | > -> > | & -
- > &
+ This context object will convert HTML Entities in the
+ $string that is passed into it and it will return the
+ converted String. This is good for dealing with CDATA. The
+ entities that are converted are: " -> " | <
+ -> < | > -> > | & - > &
</font>
</td>
@@ -499,10 +541,10 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This contains a String which is the relative path to your
- .xml document from the baseDir that was specified in your
- Ant task attributes. Please see the examples/anakia .vsl document
- for example usage of this String.
+ This contains a String which is the relative path to
+ your .xml document from the baseDir that was specified in
+ your Ant task attributes. Please see the examples/anakia
+ .vsl document for example usage of this String.
</font>
</td>
@@ -517,10 +559,11 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This contains an instance of the JDOM XMLOutputter() object.
- This allows you to easily create String output out of your JDOM
- element objects. $xmlout.outputString(Element). Again, please look
- at the examples for more information on how to use this object.
+ This contains an instance of the JDOM XMLOutputter()
+ object. This allows you to easily create String output out
+ of your JDOM element objects. $xmlout.outputString(Element).
+ Again, please look at the examples for more information on
+ how to use this object.
</font>
</td>
@@ -535,15 +578,15 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- This will allow you to
- walk a tree of JDOM Element objects starting at $element. The point
- of this context object is to allow you to build an XSLT type system
- where you can look at each Element node conditionally and set its
- content and attribute values. This is probably one of the more
- "ugly" aspects of Anakia, but it does do the job and
- suggestions for improvement are appreciated. This context object is
- still under development and more documentation will follow
- soon.
+ This will allow you to walk a tree of JDOM Element
+ objects starting at $element. The point of this context
+ object is to allow you to build an XSLT type system where
+ you can look at each Element node conditionally and set its
+ content and attribute values. This is probably one of the
+ more "ugly" aspects of Anakia, but it does do the
+ job and suggestions for improvement are appreciated. This
+ context object is still under development and more
+ documentation will follow soon.
</font>
</td>
@@ -573,6 +616,24 @@
</td>
</tr>
+ <tr>
+ <td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ $date
+
+ </font>
+</td>
+ <td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+
+ This is a new java.util.Date object. Useful for putting
+ the current date/time into a page.
+
+
+ </font>
+</td>
+ </tr>
+
</table>
</blockquote>
</td></tr>
@@ -590,15 +651,15 @@
</p>
<p>
The name <a href="http://www.kabalarians.com/female/anakia.htm">Anakia</a> is a
- cool name that I think fits this project quite nicely. "The name of Anakia
- has given you the desire for creative, artistic or musical expression in an
- original way. You strive to be different and have the self-confidence to
- implement your ideas because you have the perseverance necessary to see
- something through, despite obstacles."
+ cool name that I think fits this project quite nicely. "The name of
+ Anakia has given you the desire for creative, artistic or musical
+ expression in an original way. You strive to be different and have
+ the self-confidence to implement your ideas because you have the
+ perseverance necessary to see something through, despite obstacles."
</p>
<p>
- Further help and assistance was provided by Jason van Zyl and Geir Magnusson Jr.
- XPath support was added by Bob McWhirter.
+ Further help and assistance was provided by Jason van Zyl and Geir
+ Magnusson Jr. XPath support was added by Bob McWhirter.
</p>
</blockquote>
</td></tr>
1.14 +50 -4 jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java
Index: AnakiaTask.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AnakiaTask.java 2001/03/04 19:17:47 1.13
+++ AnakiaTask.java 2001/03/04 21:24:14 1.14
@@ -90,7 +90,7 @@
* <a href="http://jakarta.apache.org/velocity/anakia.html">Website</a>.
*
* @author <a href="jon@latchkey.com">Jon S. Stevens</a>
- * @version $Id: AnakiaTask.java,v 1.13 2001/03/04 19:17:47 jon Exp $
+ * @version $Id: AnakiaTask.java,v 1.14 2001/03/04 21:24:14 jon Exp $
*/
public class AnakiaTask extends MatchingTask
{
@@ -131,6 +131,9 @@
/** the default output extension is .html */
private String extension = ".html";
+ /** the template path */
+ private String templatePath = null;
+
/** the file to get the velocity properties file */
private File velocityPropertiesFile = null;
@@ -175,6 +178,7 @@
{
this.style = style;
}
+
/**
* Allow people to set the path to the project.xml file
*/
@@ -182,12 +186,27 @@
{
this.projectAttribute = projectAttribute;
}
+
+ /**
+ * Set the path to the templates.
+ * The way it works is this:
+ * If you have a Velocity.properties file defined, this method
+ * will <strong>override</strong> whatever is set in the
+ * Velocity.properties file. This allows one to not have to define
+ * a Velocity.properties file, therefore using Velocity's defaults
+ * only.
+ */
+ public void setTemplatePath(String templatePath)
+ {
+ this.templatePath = templatePath;
+ }
/**
* Allow people to set the path to the velocity.properties file
* This file is found relative to the path where the JVM was run.
* For example, if build.sh was executed in the ./build directory,
* then the path would be relative to this directory.
+ * This is optional based on the setting of setTemplatePath().
*/
public void setVelocityPropertiesFile(File velocityPropertiesFile)
{
@@ -228,13 +247,25 @@
{
throw new BuildException("style attribute must be set!");
}
+
if (velocityPropertiesFile == null)
{
velocityPropertiesFile = new File("velocity.properties");
+ }
+
+ // If the props file doesn't exist AND a templatePath hasn't
+ // been defined, then throw the exception. otherwise, make
+ // the propertiesFile null here so that we can check for it
+ // when we initialize the Runtime.
+ if (!velocityPropertiesFile.exists() && templatePath != null)
+ {
+ velocityPropertiesFile = null;
}
- if (!velocityPropertiesFile.exists())
+ else if (templatePath != null)
+ {
throw new BuildException ("Could not locate velocity.properties file: " +
velocityPropertiesFile.getAbsolutePath());
+ }
log("Transforming into: " + destDir.getAbsolutePath(), Project.MSG_INFO);
@@ -255,7 +286,21 @@
try
{
// initialize Velocity
- Runtime.init(velocityPropertiesFile.getAbsolutePath());
+ if (velocityPropertiesFile == null)
+ {
+ Runtime.init();
+ }
+ else
+ {
+ Runtime.init(velocityPropertiesFile.getAbsolutePath());
+ }
+ // override the templatePath if it exists
+ if (templatePath != null && templatePath.length() > 0)
+ {
+ Runtime.setSourceProperty(Runtime.FILE_RESOURCE_LOADER_PATH,
+ templatePath);
+ }
+
// get the last modification of the VSL stylesheet
styleSheetLastModified = Runtime.getTemplate(style).getLastModified();
}
@@ -321,7 +366,8 @@
context.put ("treeWalk", new TreeWalker());
context.put ("xpath", new XPathTool() );
context.put ("escape", new Escape() );
-
+ context.put ("date", new java.util.Date() );
+
// only put this into the context if it exists.
if (projectDocument != null)
context.put ("project", projectDocument.getRootElement());
1.8 +147 -104 jakarta-velocity/xdocs/anakia.xml
Index: anakia.xml
===================================================================
RCS file: /home/cvs/jakarta-velocity/xdocs/anakia.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- anakia.xml 2001/02/26 06:38:54 1.7
+++ anakia.xml 2001/03/04 21:24:15 1.8
@@ -20,33 +20,46 @@
files.
</p>
<p>
- Anakia is potentially easier to learn than XSL, but it maintains
- a similar level of functionality. Learning cryptic <xsl:>
- tags is unnecessary; you only need to know how to use the
- provided Context objects, JDOM, and Velocity's simple directives. Anakia
- seems to perform much faster than Xalan's XSL processor at creating pages.
- (23 pages are generated in 7-8 seconds on a PIII 500mhz running Win98 and
- JDK 1.3 with client Hotspot. A similar system using Ant's <style> task
- took 14-15 seconds -- nearly a 2x speed improvement.)
+ Anakia is potentially easier to learn than XSL, but it maintains a
+ similar level of functionality. Learning cryptic <xsl:> tags
+ is unnecessary; you only need to know how to use the provided
+ Context objects, JDOM, and Velocity's simple directives. Anakia
+ seems to perform much faster than Xalan's XSL processor at creating
+ pages. (23 pages are generated in 7-8 seconds on a PIII 500mhz
+ running Win98 and JDK 1.3 with client Hotspot. A similar system
+ using Ant's <style> task took 14-15 seconds -- nearly a 2x
+ speed improvement.)
+</p>
+<p>
+ Anakia -- intended to replace Stylebook, which was originally used
+ to generate simple, static web sites in which all pages had the same
+ look and feel -- is great for documentation/project web sites, such
+ as the sites on jakarta.apache.org. As it is more targeted to a
+ specific purpose, it does not provide some of XSL's
+ "extra" functionality.
</p>
<p>
- Anakia -- intended to replace Stylebook, which was
- originally used to generate simple, static web sites in which all pages had
- the same look and feel -- is great for documentation/project web sites,
- such as the sites on jakarta.apache.org. As it is more targeted to a specific
- purpose, it does not provide some of XSL's "extra" functionality.
-</p>
-<p>
The example in the jakarta-velocity/examples/anakia directory
- provides a good introduction to Anakia. You should find it quite simple to use.
+ provides a good introduction to Anakia. You should find it quite
+ simple to use.
</p>
<p>
- Anakia creates a Context, which contains a JDOM Document object of the
- .xml page, as well as an (optional) JDOM Document object of your project.xml
- page. The .vsl page is executed (using Velocity) with the Context. You can then
- navigate your .xml file and pull information out of it by simply executing methods
- on the JDOM Document object.
+ Anakia creates a Context, which contains a JDOM Document object of
+ the .xml page, as well as an (optional) JDOM Document object of your
+ project.xml page. The .vsl page is executed (using Velocity) with
+ the Context. You can then navigate your .xml file and pull
+ information out of it by simply executing methods on the JDOM
+ Document object.
+</p>
+<p>
+ Anakia is being used to create the documentation for not only this
+ website, but also for the Jakarta Project's website as well as
+ many of the projects that live under the Jakarta Project. This
+ process is
+ <a href="http://jakarta.apache.org/site/jakarta-site2.html">documented</a>
+ on the site. You are welcome to use this for your own needs as well.
</p>
+
</section>
<section name="Installation/Example">
@@ -55,29 +68,30 @@
you must <a href="install.html">build Velocity</a>.
</p>
<p>
- After building Velocity, <code>cd</code> into the jakarta-velocity/examples/anakia/build
- directory and run <code>./build.sh</code>. (Shell scripts will work on
- the Windows platform if you install <a
+ After building Velocity, <code>cd</code> into the
+ jakarta-velocity/examples/anakia/build directory and run
+ <code>./build.sh</code>. (Shell scripts will work on the Windows
+ platform if you install <a
href="http://sources.redhat.com/cygwin/">Cygwin</a>.)
</p>
<p>
- Output from the build.sh script, in this case HTML files, is placed into the
- jakarta-velocity/examples/anakia/docs/ directory.
+ Output from the build.sh script, in this case HTML files, is placed
+ into the jakarta-velocity/examples/anakia/docs/ directory.
</p>
<p>
- The jakarta-velocity/examples/anakia/xdocs/ directory has all of the .xml
- source code. The xdocs/stylesheets directory contains the
- .vsl file, in which most of the magic happens. Understanding
- <a href="user-guide.html">Velocity Template Language</a> and JDOM
- is necessary to understand how the .vsl file works.
+ The jakarta-velocity/examples/anakia/xdocs/ directory has all of the
+ .xml source code. The xdocs/stylesheets directory contains the .vsl
+ file, in which most of the magic happens. Understanding <a
+ href="user-guide.html">Velocity Template Language</a> and JDOM is
+ necessary to understand how the .vsl file works.
</p>
</section>
<section name="How does it work?">
<p>
- Anakia is an Ant task that executes from an Ant build file. The build file looks
- something like this:
+ Anakia is an Ant task that executes from an Ant build file. The
+ build file looks something like this:
</p>
<source><![CDATA[
@@ -126,73 +140,93 @@
</tr>
<tr>
<td>basedir</td>
- <td>Specifies the path to the directory location of your .xml files.</td>
+ <td>Specifies the path to the directory location of your
+ .xml files.</td>
</tr>
<tr>
<td>destdir</td>
- <td>Specifies the path to the directory where the output files should go.</td>
+ <td>Specifies the path to the directory where the output
+ files should go.</td>
</tr>
<tr>
<td>extension</td>
- <td>This is the extension that is appended to the end of your .xml file. For example,
- with an extension of ".html", index.xml would be converted into index.html.
- By default, the extension is .html.
+ <td>
+ This is the extension that is appended to the end of your
+ .xml file. For example, with an extension of ".html",
+ index.xml would be converted into index.html. By default,
+ the extension is .html.
</td>
</tr>
<tr>
<td>style</td>
- <td>This is the path (relative to Velocity's template.loader.1.template.path)
- to the VelocityStyleTemplate to process. This file is the equivalent to the
- .xsl file in Ant's style task.
- </td>
+ <td>This is the path (relative to Velocity's
+ template.loader.1.template.path) to the
+ VelocityStyleTemplate to process. This file is the
+ equivalent to the .xsl file in Ant's style task. </td>
</tr>
<tr>
<td>projectFile</td>
- <td>This is the path to a "project" file. This file is an XML file
- that can be used as a "navigation" file. If you have used Stylebook
- or Struts system for generation of the web site documentation, you
- will understand the purpose of this file. <strong>It is an optional
- task argument.</strong> If you look at the Anakia example in the
- jakarta-velocity/examples/anakia directory, you can see the project.xml
- file being used in the .vsl file.
- </td>
+ <td>This is the path to a "project" file. This file is an
+ XML file that can be used as a "navigation" file. If you
+ have used Stylebook or Struts system for generation of the
+ web site documentation, you will understand the purpose of
+ this file. <strong>It is an optional task argument.</strong>
+ If you look at the Anakia example in the
+ jakarta-velocity/examples/anakia directory, you can see the
+ project.xml file being used in the .vsl file. </td>
</tr>
<tr>
<td>excludes</td>
- <td>This is the standard Ant excludes attribute. Specify any files
- or directories that you do not want Anakia to try to process.</td>
+ <td>This is the standard Ant excludes attribute. Specify any
+ files or directories that you do not want Anakia to try to
+ process.</td>
</tr>
<tr>
<td>includes</td>
- <td>This is the standard Ant includes attribute. Specify any files
- or directories that you do want Anakia to try to process.</td>
+ <td>This is the standard Ant includes attribute. Specify any
+ files or directories that you do want Anakia to try to
+ process.</td>
</tr>
<tr>
<td>lastModifiedCheck</td>
- <td>This turns on or off the ability to check the last modified date on files
- in order to determine whether or not they need to be re-rendered or not.
- The value of this attribute can be "true, false, yes, no". By
- default, it is true, meaning that the last modified date should be checked
- and if the original .xml file, project file, or .vsl file have not changed,
- then don't process the page. This accelerates processing because
- pages that have not changed will not get reprocessed.</td>
+ <td>This turns on or off the ability to check the last
+ modified date on files in order to determine whether or not
+ they need to be re-rendered or not. The value of this
+ attribute can be "true, false, yes, no". By default, it is
+ true, meaning that the last modified date should be checked
+ and if the original .xml file, project file, or .vsl file
+ have not changed, then don't process the page. This
+ accelerates processing because pages that have not changed
+ will not get reprocessed.</td>
+ </tr>
+ <tr>
+ <td>templatePath</td>
+ <td>This is the path to the templateRoot which is the
+ directory where your site.vsl file is located. This can be
+ defined in the Velocity.properties or it can be defined
+ here. It it an optional argument if it is defined in the
+ Velocity properties file already. However, if defined, this
+ value will override the path defined in the
+ Velocity.properties file.</td>
</tr>
<tr>
<td>velocityPropertiesFile</td>
- <td>This is the path to the velocity.properties file. It is an optional
- argument and by default is set to find the properties file in the same
- directory that the JVM was started in.</td>
+ <td>This is the path to the velocity.properties file. It is
+ an optional argument and by default is set to find the
+ properties file in the same directory that the JVM was
+ started in.</td>
</tr>
</table>
</section>
<section name="Context Objects">
<p>
- The Anakia Ant task places several objects into the Context for you. Right now,
- you do not have control over what is placed into the Context. Eventually,
- we hope to have a way to give you control over this. However, that does not prevent
- Anakia from being extremely useful for you today. :-)
- The objects that are available to you in your .vsl template are:
+ The Anakia Ant task places several objects into the Context for you.
+ Right now, you do not have control over what is placed into the
+ Context. Eventually, we hope to have a way to give you control over
+ this. However, that does not prevent Anakia from being extremely
+ useful for you today. :-) The objects that are available to you in
+ your .vsl template are:
</p>
<table border="0">
@@ -206,45 +240,46 @@
</tr>
<tr>
<td>$project</td>
- <td>This contains the JDOM root Element to your project.xml document.
- If you have not specified a project.xml document, then this variable
- will not be in the context.
- </td>
+ <td>This contains the JDOM root Element to your project.xml
+ document. If you have not specified a project.xml document,
+ then this variable will not be in the context. </td>
</tr>
<tr>
<td>$escape.getText($string)</td>
- <td>This context object will convert HTML Entities in the $string
- that is passed into it and it will return the converted String. This
- is good for dealing with CDATA. The entities that are converted are:
- " -> &quot; | < -> &lt; | > -> &gt; | & -
- > &amp; </td>
+ <td>This context object will convert HTML Entities in the
+ $string that is passed into it and it will return the
+ converted String. This is good for dealing with CDATA. The
+ entities that are converted are: " -> &quot; | <
+ -> &lt; | > -> &gt; | & - > &amp; </td>
</tr>
<tr>
<td>$relativePath</td>
- <td>This contains a String which is the relative path to your
- .xml document from the baseDir that was specified in your
- Ant task attributes. Please see the examples/anakia .vsl document
- for example usage of this String.</td>
+ <td>This contains a String which is the relative path to
+ your .xml document from the baseDir that was specified in
+ your Ant task attributes. Please see the examples/anakia
+ .vsl document for example usage of this String.</td>
</tr>
<tr>
<td>$xmlout</td>
- <td>This contains an instance of the JDOM XMLOutputter() object.
- This allows you to easily create String output out of your JDOM
- element objects. $xmlout.outputString(Element). Again, please look
- at the examples for more information on how to use this object.</td>
+ <td>This contains an instance of the JDOM XMLOutputter()
+ object. This allows you to easily create String output out
+ of your JDOM element objects. $xmlout.outputString(Element).
+ Again, please look at the examples for more information on
+ how to use this object.</td>
+ </tr>
+ <tr>
+ <td>$treeWalk.allElements($element)</td>
+ <td>This will allow you to walk a tree of JDOM Element
+ objects starting at $element. The point of this context
+ object is to allow you to build an XSLT type system where
+ you can look at each Element node conditionally and set its
+ content and attribute values. This is probably one of the
+ more "ugly" aspects of Anakia, but it does do the
+ job and suggestions for improvement are appreciated. This
+ context object is still under development and more
+ documentation will follow soon.</td>
</tr>
<tr>
- <td>$treeWalk.allElements($element)</td> <td>This will allow you to
- walk a tree of JDOM Element objects starting at $element. The point
- of this context object is to allow you to build an XSLT type system
- where you can look at each Element node conditionally and set its
- content and attribute values. This is probably one of the more
- "ugly" aspects of Anakia, but it does do the job and
- suggestions for improvement are appreciated. This context object is
- still under development and more documentation will follow
- soon.</td>
- </tr>
- <tr>
<td>$xpath.applyTo("document/properties/@title", $root)</td>
<td>
The W3C XPath Specification <a
@@ -257,6 +292,14 @@
for more information.
</td>
</tr>
+ <tr>
+ <td>$date</td>
+ <td>
+ This is a new java.util.Date object. Useful for putting
+ the current date/time into a page.
+ </td>
+ </tr>
+
</table>
</section>
@@ -268,15 +311,15 @@
<p>
The name <a
href="http://www.kabalarians.com/female/anakia.htm">Anakia</a> is a
- cool name that I think fits this project quite nicely. "The name of Anakia
- has given you the desire for creative, artistic or musical expression in an
- original way. You strive to be different and have the self-confidence to
- implement your ideas because you have the perseverance necessary to see
- something through, despite obstacles."
+ cool name that I think fits this project quite nicely. "The name of
+ Anakia has given you the desire for creative, artistic or musical
+ expression in an original way. You strive to be different and have
+ the self-confidence to implement your ideas because you have the
+ perseverance necessary to see something through, despite obstacles."
</p>
<p>
- Further help and assistance was provided by Jason van Zyl and Geir Magnusson Jr.
- XPath support was added by Bob McWhirter.
+ Further help and assistance was provided by Jason van Zyl and Geir
+ Magnusson Jr. XPath support was added by Bob McWhirter.
</p>
</section>
1.3 +0 -90 jakarta-velocity/examples/anakia/build/velocity.properties
Index: velocity.properties
===================================================================
RCS file: /home/cvs/jakarta-velocity/examples/anakia/build/velocity.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- velocity.properties 2001/01/03 06:20:17 1.2
+++ velocity.properties 2001/03/04 21:24:15 1.3
@@ -1,91 +1 @@
-#----------------------------------------------------------------------------
-# These are the default properties for the
-# Velocity Runtime. These values are used when
-# Runtime.init() is called, and when Runtime.init(properties)
-# fails to find the specificed properties file.
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# R U N T I M E L O G
-#----------------------------------------------------------------------------
-# This is the location of the Velocity Runtime log.
-#----------------------------------------------------------------------------
-
-runtime.log = velocity.log
-
-#----------------------------------------------------------------------------
-# T E M P L A T E E N C O D I N G
-#----------------------------------------------------------------------------
-
-template.encoding=8859_1
-
-#----------------------------------------------------------------------------
-# C O N T E N T T Y P E
-#----------------------------------------------------------------------------
-# This is the default content type for the VelocityServlet.
-#----------------------------------------------------------------------------
-
-default.contentType=text/html
-
-#----------------------------------------------------------------------------
-# F O R E A C H P R O P E R T I E S
-#----------------------------------------------------------------------------
-# These properties control how the counter is accessed in the #foreach
-# directive. By default the reference $velocityCount will be available
-# in the body of the #foreach directive. The default starting value
-# for this reference is 1.
-#----------------------------------------------------------------------------
-
-counter.name = velocityCount
-counter.initial.value = 1
-
-#----------------------------------------------------------------------------
-# I N C L U D E P R O P E R T I E S
-#----------------------------------------------------------------------------
-# These are the properties that governed the way #include'd content
-# is governed.
-#----------------------------------------------------------------------------
-
-include.output.errormsg.start = <!-- include error :
-include.output.errormsg.end = see error log -->
-
-#----------------------------------------------------------------------------
-# P A R S E P R O P E R T I E S
-#----------------------------------------------------------------------------
-
-parse_directive.maxdepth = 10
-
-#----------------------------------------------------------------------------
-# T E M P L A T E L O A D E R S
-#----------------------------------------------------------------------------
-#
-#
-#----------------------------------------------------------------------------
-
-resource.loader.1.public.name = File
-resource.loader.1.description = Velocity File Resource Loader
-resource.loader.1.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader
resource.loader.1.resource.path = ../xdocs/stylesheets
-resource.loader.1.cache = false
-resource.loader.1.modificationCheckInterval = 2
-
-#----------------------------------------------------------------------------
-# E X T E R N A L S E R V I C E I N I T I A L I Z A T I O N
-#----------------------------------------------------------------------------
-# If this property is set to true then an external service will
-# set certain system properties and initialize the Velocity
-# Runtime. This method is used by Turbine to initialize the
-# Velocity Runtime for the TurbineVelocityService.
-#----------------------------------------------------------------------------
-
-external.init = false
-
-#----------------------------------------------------------------------------
-# VELOCIMACRO GLOBAL LIBRARY
-#----------------------------------------------------------------------------
-# name of default global library. It is expected to be in the regular
-# template path. You may remove it (either the file or this property) if
-# you wish with no harm.
-#----------------------------------------------------------------------------
-#velocimacro.library.global=VM_global_library.vm
-