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...@locus.apache.org on 2000/11/22 20:36:46 UTC
cvs commit: jakarta-velocity/examples/anakia/xdocs/stylesheets project.xml site.vsl
jon 00/11/22 11:36:46
Added: examples/anakia/build build.sh build.xml velocity.properties
examples/anakia/xdocs index.xml
examples/anakia/xdocs/images velocity.gif
examples/anakia/xdocs/stylesheets project.xml site.vsl
Log:
added example for using the Anakia task
Revision Changes Path
1.1 jakarta-velocity/examples/anakia/build/build.sh
Index: build.sh
===================================================================
#! /bin/sh
if [ "$JAVA_HOME" = "" ] ; then
echo You must set JAVA_HOME to point at your Java Development Kit directory
exit 1
fi
# convert the existing path to unix
if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
CLASSPATH=$CLASSPATH:../../../build/lib/ant-1.2.jar
CLASSPATH=$CLASSPATH:../../../build/lib/ant-1.2-optional.jar
CLASSPATH=$CLASSPATH:../../../build/lib/xerces-1.2.1.jar
CLASSPATH=$CLASSPATH:../../../build/lib/jdom-b5.jar
CLASSPATH=$CLASSPATH:../../../bin/velocity-0.5.jar
# convert the unix path to windows
if [ "$OSTYPE" = "cygwin32" ] || [ "$OSTYPE" = "cygwin" ] ; then
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
fi
BUILDFILE=build.xml
echo $CLASSPATH
java $ANT_OPTS -classpath "$CLASSPATH" org.apache.tools.ant.Main \
-Dant.home=$ANT_HOME \
-buildfile ${BUILDFILE} \
"$@"
1.1 jakarta-velocity/examples/anakia/build/build.xml
Index: build.xml
===================================================================
<project name="build-site" default="docs" basedir=".">
<!-- Initialization properties -->
<property name="project.name" value="site"/>
<property name="docs.src" value="../xdocs"/>
<property name="docs.dest" value="../docs"/>
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask"/>
<target name="prepare">
</target>
<target name="docs" depends="prepare">
<anakia basedir="${docs.src}" destdir="${docs.dest}/"
extension=".html" style="./site.vsl"
projectFile="./stylesheets/project.xml"
excludes="**/stylesheets/**"
includes="**/*.xml">
</anakia>
<copy todir="${docs.dest}/images" filtering="no">
<fileset dir="${docs.src}/images">
<include name="**/*.gif"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
</fileset>
</copy>
<!-- In case we have CSS someday
<copy todir="${docs.dest}" filtering="no">
<fileset dir="${docs.src}">
<include name="**/*.css"/>
</fileset>
</copy>
-->
</target>
</project>
1.1 jakarta-velocity/examples/anakia/build/velocity.properties
Index: velocity.properties
===================================================================
#----------------------------------------------------------------------------
# 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.path=../xdocs/stylesheets
include.cache = false
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
#----------------------------------------------------------------------------
#
#
#----------------------------------------------------------------------------
template.loader.1.public.name = File
template.loader.1.description = Velocity File Template Loader
template.loader.1.class = org.apache.velocity.runtime.loader.FileTemplateLoader
template.loader.1.template.path = ../xdocs/stylesheets
template.loader.1.cache = false
template.loader.1.modificationCheckInterval = 2
#template.loader.2.public.name = URL
#template.loader.2.description = Velocity URL Template Loader
#template.loader.2.class = org.apache.velocity.runtime.loader.URLTemplateLoader
#template.loader.2.template.path = http://localhost/templates/
#template.loader.2.cache = false
#----------------------------------------------------------------------------
# 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
1.1 jakarta-velocity/examples/anakia/xdocs/index.xml
Index: index.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<document prefix="." url="./index.xml">
<properties>
<author email="jon@latchkey.com">Jon S. Stevens</author>
<title>The Jakarta Project</title>
</properties>
<body>
<section name="Section 1">
<p>
This is an example template that gets processed.
</p>
<img src="./images/velocity.gif"/>
<table border="1">
<tr>
<td>
It even has a table in it!
</td>
</tr>
</table>
<h3>And an h3 tag</h3>
</section>
<section name="Section 2">
<p> here is another section </p>
</section>
</body>
</document>
1.1 jakarta-velocity/examples/anakia/xdocs/images/velocity.gif
<<Binary file>>
1.1 jakarta-velocity/examples/anakia/xdocs/stylesheets/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Jakarta Site"
href="http://jakarta.apache.org/">
<title>Jakarta Site</title>
<menu name="Essentials">
<item name="Front Page" href="index.html"/>
<item name="News & Status" href="news.html"/>
<item name="Mission" href="mission.html"/>
<item name="Guidelines Notes" href="guidelines.html"/>
<item name="FAQs" href="faqs.html"/>
</menu>
<menu name="Download">
<item name="Binaries" href="binindex.html"/>
<item name="Source Code" href="sourceindex.html"/>
</menu>
<menu name="Get Involved">
<item name="Overview" href="getinvolved.html"/>
<item name="CVS Repositories" href="cvsindex.html"/>
<item name="Mailing Lists" href="mail.html"/>
<item name="Reference Library" href="reference.html"/>
<item name="Bug Database" href="bugs.html"/>
</menu>
<menu name="SubProjects">
<item name="Ant" href="/ant/index.html"/>
<item name="ORO" href="/oro/index.html"/>
<item name="Regexp" href="/regexp/index.html"/>
<item name="Slide" href="/slide/index.html"/>
<item name="Struts" href="/struts/index.html"/>
<item name="Taglibs" href="/taglibs/index.html"/>
<item name="Tomcat" href="/tomcat/index.html"/>
<item name="Velocity" href="/velocity/index.html"/>
<item name="Watchdog" href="/watchdog/index.html"/>
</menu>
<menu name="Credits">
<item name="Who We Are" href="whoweare.html"/>
<item name="Acknowledgements" href="acknowledgements.txt"/>
</menu>
</project>
1.1 jakarta-velocity/examples/anakia/xdocs/stylesheets/site.vsl
Index: site.vsl
===================================================================
<!-- Content Stylesheet for Site -->
## Defined variables
#set $bodybg = "#ffffff"
#set $bodyfg = "#000000"
#set $bodylink = "#525D76"
#set $bannerbg = "#525D76"
#set $bannerfg = "#ffffff"
#set $tablethbg = "#039acc"
#set $tabletdbg = "#a0ddf0"
<!-- start the processing -->
#document()
<!-- end the processing -->
## This is where the macro's live
#macro (document)
<!-- ====================================================================== -->
<!-- Main Page Section -->
<!-- ====================================================================== -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
#set $au = $root.getChild("properties").getChild("author").getText()
#set $em = $root.getChild("properties").getChild("author").getAttributeValue("email")
#metaauthor ( $au $em )
<title>$root.getChild("properties").getChild("title").getText()</title>
</head>
<body bgcolor="$bodybg" text="$bodyfg" link="$bodylink">
#set $sections = $root.getChild("body").getChildren("section")
#foreach ( $sec in $sections )
#set $data = $sec.getChildren()
#foreach ( $item in $data )
$xmlout.outputString($item)
#end
#end
</body>
</html>
#end
#macro ( metaauthor $author $email )
<meta name="author" value="$author">
<meta name="email" value="$email">
#end