jvanzyl 2002/06/26 14:19:34
Added: src/templates/build/plugins/docbook docbook2document.xsl
plugin.jelly plugin.properties
Log:
docbook plugin
Revision Changes Path
1.1
jakarta-turbine-maven/src/templates/build/plugins/docbook/docbook2document.xsl
Index: docbook2document.xsl
===================================================================
<?xml version="1.0"?>
<!--
Author: Berin Loritsch ([EMAIL PROTECTED])
Author: Peter Donald ([EMAIL PROTECTED])
Author: dIon Gillard ([EMAIL PROTECTED])
Version: $Id: docbook2document.xsl,v 1.1 2002/06/26 21:19:34 jvanzyl Exp $
FIXME: - Doesn't handle attributes of informaltable and other docbook
elements
- currently doesn't process all docbook-simple elements
- still has some docbook leftovers
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- used for cross ref links (xref) -->
<xsl:key name="id" match="*" use="@id"/>
<xsl:template match="/">
<xsl:comment>This document generated by docbook2document.xsl</xsl:comment>
<xsl:apply-templates />
</xsl:template>
<!--
top level components create document, properties element and start body
-->
<xsl:template match="article">
<document>
<properties>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="author"/>
</properties>
<body>
<xsl:apply-templates />
<xsl:apply-templates select="//footnote" mode="base"/>
</body>
</document>
</xsl:template>
<xsl:template match="title">
<title>
<xsl:value-of select="title"/>
<xsl:if test="../subtitle">
(<xsl:value-of select="../subtitle"/>)
</xsl:if>
<!-- ignoring titleabbrev -->
</title>
</xsl:template>
<!-- author block -->
<xsl:template match="author">
<author email="{authorblurb/para/email}">
<xsl:if test="honorific"><xsl:value-of select="honorific"/>. </xsl:if>
<xsl:if test="firstname">
<xsl:value-of select="firstname"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:value-of select="surname"/>
<xsl:apply-templates />
</author>
<xsl:template match="affiliation">
<xsl:if test="jobtitle">
(Job title: <xsl:value-of select="jobtitle"/>
</xsl:if>
<xsl:if test="orgname">
, Organisation:</i> <xsl:value-of select="orgname"/>)
</xsl:if>
</xsl:template>
<xsl:template match="authorblurb">
<xsl:text>Bio</xsl:text>
<ul>
<xsl:apply-templates/>
</ul>
</xsl:template>
<xsl:template
match="honorific|firstname|surname|orgdiv|orgname|shortaffil|jobtitle"/>
<!-- revision history -->
<xsl:template match="revhistory">
<section name="Revision History">
<xsl:variable name="unique-revisions"
select="revision[not(revnumber=preceding-sibling::revision/revnumber)]/revnumber"/>
<xsl:variable name="base" select="."/>
<xsl:for-each select="$unique-revisions">
<p>Revision <xsl:value-of select="."/>
(<xsl:value-of select="$base/revision[revnumber=current()]/date"/>)
</p>
<ul>
<xsl:apply-templates select="$base/revision[revnumber=current()]"/>
</ul>
</xsl:for-each>
</section>
</xsl:template>
<xsl:template match="revision">
<li>
<xsl:choose>
<xsl:when test="@revisionflag='added'">
<img align="absmiddle" alt="added" border="0" src="images/add.jpg"/>
</xsl:when>
<xsl:when test="@revisionflag='changed'">
<img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
</xsl:when>
<xsl:when test="@revisionflag='deleted'">
<img align="absmiddle" alt="deleted" border="0" src="images/remove.jpg"/>
</xsl:when>
<xsl:when test="@revisionflag='off'">
<img align="absmiddle" alt="off" border="0" src="images/fix.jpg"/>
</xsl:when>
<xsl:otherwise>
<img align="absmiddle" alt="changed" border="0" src="images/update.jpg"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="revremark"/>
<xsl:text> (</xsl:text><xsl:value-of
select="authorinitials"/><xsl:text>)</xsl:text>
</li>
</xsl:template>
<xsl:template match="revnumber|revremark|authorinitials|date"/>
<xsl:template match="section">
<xsl:call-template name="section-common">
<xsl:with-param name="level" select="1"/>
</xsl:call-template>
</xsl:template>
<!-- sections - and nested -->
<xsl:template name="section-common">
<xsl:param name="level"/>
<xsl:choose>
<xsl:when test="number($level)=1">
<xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
<section name="{title}">
<xsl:apply-templates>
<xsl:with-param name="level" select="number($level)+1"/>
</xsl:apply-templates>
</section>
</xsl:when>
<xsl:when test="number($level)=2">
<xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
<subsection name="{title}">
<xsl:apply-templates>
<xsl:with-param name="level" select="number($level)+1"/>
</xsl:apply-templates>
</subsection>
</xsl:when>
<xsl:otherwise>
<xsl:if test="@id"><a name="{@id}"> </a></xsl:if>
<p><a name="{@name}"><strong><xsl:value-of select="title"/></strong></a><br
/>
<xsl:apply-templates>
<xsl:with-param name="level" select="number($level)+1"/>
</xsl:apply-templates>
</p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- paragraphs/textual elements -->
<xsl:template match="para">
<p><xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="emphasis"><em><xsl:apply-templates/></em></xsl:template>
<xsl:template match="example">
<p><pre><xsl:apply-templates/></pre></p>
</xsl:template>
<!-- book details -->
<xsl:template match="bookinfo">
<b><xsl:value-of select="edition"/></b><xsl:text> </xsl:text>
<i>pub. <xsl:value-of select="pubdate"/></i>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="dedication">
<b>Dedication</b>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="edition|pubdate|year|holder"/>
<xsl:template match="copyright">
<p>Copyright ©<xsl:value-of select="year"/> by
<xsl:value-of select="holder"/>.<br/>
<i>All rights reserved.</i>
</p>
</xsl:template>
<xsl:template match="legalnotice">
<p>Legal Notice</p>
<xsl:apply-templates/>
</xsl:template>
<!-- lists etc -->
<xsl:template match="programlisting">
<source><xsl:apply-templates/></source>
</xsl:template>
<xsl:template match="orderedlist"><ol><xsl:apply-templates/></ol></xsl:template>
<xsl:template
match="listitem|member"><li><xsl:apply-templates/></li></xsl:template>
<xsl:template
match="itemizedlist|simplelist"><ul><xsl:apply-templates/></ul></xsl:template>
<xsl:template
match="classname|function|parameter"><code><xsl:apply-templates/><xsl:if
test="name(.)='function'"><xsl:text>()</xsl:text></xsl:if></code></xsl:template>
<xsl:template match="blockquote">
<xsl:if test="title">
<blockquote><xsl:value-of select="title"/><br/>
<xsl:apply-templates/>
</blockquote>
</xsl:if>
<p></p>
</xsl:template>
<xsl:template match="warning">
<xsl:if test="title">
<p><em><xsl:value-of select="title"/></em></p>
</xsl:if>
<p><xsl:apply-templates/></p>
</xsl:template>
<!-- links -->
<xsl:template match="ulink"><a
href="{@url}"><xsl:apply-templates/></a></xsl:template>
<xsl:template match="xref">
<!--
make a link to the linkend specified, prefixing with a # since it's
internal to the generated html. The text of the link should be either
a) element pointed to by linkend's xreflabel or
b) endterm content
-->
<xsl:variable name="link-targets" select="key('id',@linkend)"/>
<xsl:variable name="link-target" select="$link-targets[1]"/>
<a href="#{@linkend}">
<!-- xreflabel of target goes here-->
<xsl:choose>
<xsl:when test="$link-target/@xreflabel">
<xsl:value-of select="$link-target/@xreflabel"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="endterm-targets" select="key('id',@endterm)"/>
<xsl:variable name="endterm-target" select="$endterm-targets[1]"/>
<xsl:apply-templates select="$endterm-target"/>
</xsl:otherwise>
</xsl:choose>
</a>
</xsl:template>
<!-- tables, footnotes etc -->
<xsl:template match="footnote">
<sup><a href="#{generate-id(.)}"><xsl:value-of select="generate-id(.)"/></a>
</sup>
</xsl:template>
<xsl:template match="footnote" mode="base">
<a name="{generate-id(.)}"/><xsl:value-of select="generate-id(.)"/><xsl:text>)
</xsl:text><i><xsl:value-of select="."/></i>
</xsl:template>
<xsl:template match="figure">
<p>Figure: <xsl:value-of select="title"/></p>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="graphic">
<img border="0" alt="{@srccredit}" src="{@fileref}"/>
<xsl:if test="@srccredit">
<ul><li><xsl:value-of select="@srccredit"/></li></ul>
</xsl:if>
</xsl:template>
<xsl:template match="table"><table><xsl:apply-templates/></table></xsl:template>
<!-- FIXME: support attributes of informal table here -->
<xsl:template match="informaltable">
<table><xsl:apply-templates/></table>
</xsl:template>
<xsl:template match="tgroup">
<xsl:apply-templates select="thead|tbody|tfoot"/>
</xsl:template>
<xsl:template match="thead">
<xsl:apply-templates select="row" mode="head"/>
</xsl:template>
<xsl:template match="row" mode="head">
<tr><xsl:apply-templates select="entry" mode="head"/></tr>
</xsl:template>
<xsl:template match="row">
<tr><xsl:apply-templates/></tr>
</xsl:template>
<xsl:template match="tbody|tfoot">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="entry" mode="head">
<th><xsl:apply-templates/></th>
</xsl:template>
<xsl:template match="entry">
<td><xsl:apply-templates/></td>
</xsl:template>
<xsl:template match="firstterm">
<i><xsl:apply-templates/></i>
</xsl:template>
<xsl:template match="remark">
<p><b>Note:</b> <xsl:apply-templates/></p>
</xsl:template>
<xsl:template match="sgmltag">
<code><xsl:apply-templates/></code>
</xsl:template>
<xsl:template match="trademark"><xsl:apply-templates/><sup>TM</sup></xsl:template>
<xsl:template match="node()|@*" priority="-1">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
1.1
jakarta-turbine-maven/src/templates/build/plugins/docbook/plugin.jelly
Index: plugin.jelly
===================================================================
<?xml version="1.0"?>
<project xmlns:j="jelly:core">
<!-- ================================================================== -->
<!-- S I M P L E D O C B O O K D O C U M E N T A T I O N -->
<!-- ================================================================== -->
<goal
name="docbook-simple"
description="Transform any docbook-simple source into xdocs for later use">
<j:if test="${flags.docbookSimpleOk}">
<style basedir="${maven.src.docbook-simple}"
destdir="${maven.gen.docs}" extension=".xml"
style="${maven.home}/plugins/docbook/docbook2document.xsl"
includes="**/*.xml, **/*.sgml"/>
</j:if>
</goal>
<!-- ================================================================== -->
<!-- D V S L D O C U M E N T A T I O N -->
<!-- ================================================================== -->
<goal
name="docs:site"
description="o Generate html project documentation xdoc sources">
<!-- Transform the auto-generated xdocs first -->
<dvsl
basedir="${maven.gen.docs}"
destdir="${maven.docs.dest}/"
extension=".html"
force="true"
toolboxfile="${maven.home}/stylesheets/toolbox.props"
style="${maven.home}/stylesheets/site.dvsl"
excludes="**/project.xml,**/template.xml"
includes="**/*.xml"
outputencoding="${maven.docs.outputencoding}">
<!-- Need to add the maven jar to load the toolbox -->
<classpath refid="maven-classpath"/>
<tool name="toolbox.string.basedir" value="${basedir}"/>
<tool name="toolbox.string.docDest" value="${maven.docs.dest}"/>
<tool name="toolbox.string.docSrc" value="${maven.docs.src}"/>
<tool name="toolbox.string.genDoc" value="${maven.gen.docs}"/>
<tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
<tool name="toolbox.string.srcPresent" value="${maven.sourcesPresent}"/>
<tool name="toolbox.string.testSrcPresent"
value="${maven.unitTestSourcesPresent}"/>
<tool name="toolbox.string.currentYear" value="${maven.current.year}"/>
</dvsl>
<!-- Then transform user supplied xdocs next -->
<dvsl
basedir="${maven.docs.src}"
destdir="${maven.docs.dest}/"
extension=".html"
force="true"
toolboxfile="${maven.home}/stylesheets/toolbox.props"
style="${maven.home}/stylesheets/site.dvsl"
excludes="**/project.xml,**/template.xml"
includes="**/*.xml"
outputencoding="${maven.docs.outputencoding}">
<!-- Need to add the maven jar to load the toolbox -->
<classpath refid="maven-classpath"/>
<tool name="toolbox.string.basedir" value="${basedir}"/>
<tool name="toolbox.string.docSrc" value="${maven.docs.src}"/>
<tool name="toolbox.string.srcDir" value="${maven.src.dir}"/>
<tool name="toolbox.string.genDoc" value="${maven.gen.docs}"/>
<tool name="toolbox.string.srcPresent" value="${maven.sourcesPresent}"/>
<tool name="toolbox.string.testSrcPresent"
value="${maven.unitTestSourcesPresent}"/>
<tool name="toolbox.string.currentYear" value="${maven.current.year}"/>
</dvsl>
<!-- Copy site images -->
<copy todir="${maven.docs.dest}/images" filtering="no">
<fileset dir="${maven.home}/images">
<include name="**/*.gif"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
<include name="**/*.png"/>
</fileset>
</copy>
<!-- Copy user supplied images -->
<copy todir="${maven.docs.dest}/images" filtering="no">
<fileset dir="${maven.docs.src}/images">
<include name="**/*.gif"/>
<include name="**/*.jpeg"/>
<include name="**/*.jpg"/>
<include name="**/*.png"/>
</fileset>
</copy>
<!-- Copy maven supplied stylesheets. -->
<copy todir="${maven.docs.dest}/style" overwrite="yes" filtering="yes">
<fileset dir="${maven.home}/stylesheets">
<include name="**/*.css"/>
</fileset>
<filterset>
<filter token="UI_BODY_BACKGROUND" value="${maven.ui.body.background}"/>
<filter token="UI_BODY_FOREGROUND" value="${maven.ui.body.foreground}"/>
<filter token="UI_SECTION_BACKGROUND"
value="${maven.ui.section.background}"/>
<filter token="UI_SECTION_FOREGROUND"
value="${maven.ui.section.foreground}"/>
<filter token="UI_SUBSECTION_BACKGROUND"
value="${maven.ui.subsection.background}"/>
<filter token="UI_SUBSECTION_FOREGROUND"
value="${maven.ui.subsection.foreground}"/>
<filter token="UI_TABLE_HEADER_BACKGROUND"
value="${maven.ui.table.header.background}"/>
<filter token="UI_TABLE_HEADER_FOREGROUND"
value="${maven.ui.table.header.foreground}"/>
<filter token="UI_TABLE_ROW_ODD_BACKGROUND"
value="${maven.ui.table.row.odd.background}"/>
<filter token="UI_TABLE_ROW_ODD_FOREGROUND"
value="${maven.ui.table.row.odd.foreground}"/>
<filter token="UI_TABLE_ROW_EVEN_BACKGROUND"
value="${maven.ui.table.row.even.background}"/>
<filter token="UI_TABLE_ROW_EVEN_FOREGROUND"
value="${maven.ui.table.row.even.foreground}"/>
<filter token="UI_BANNER_BACKGROUND" value="${maven.ui.banner.background}"/>
<filter token="UI_BANNER_FOREGROUND" value="${maven.ui.banner.foreground}"/>
<filter token="UI_BANNER_BORDER_TOP" value="${maven.ui.banner.border.top}"/>
<filter token="UI_BANNER_BORDER_BOTTOM"
value="${maven.ui.banner.border.bottom}"/>
<filter token="UI_SOURCE_BACKGROUND" value="${maven.ui.source.background}"/>
<filter token="UI_SOURCE_FOREGROUND" value="${maven.ui.source.foreground}"/>
<filter token="UI_SOURCE_BORDER_TOP" value="${maven.ui.source.border.top}"/>
<filter token="UI_SOURCE_BORDER_BOTTOM"
value="${maven.ui.source.border.bottom}"/>
<filter token="UI_SOURCE_BORDER_RIGHT"
value="${maven.ui.source.border.right}"/>
<filter token="UI_SOURCE_BORDER_LEFT"
value="${maven.ui.source.border.left}"/>
<filter token="UI_NAVCOL_BACKGROUND" value="${maven.ui.navcol.background}"/>
<filter token="UI_NAVCOL_FOREGROUND" value="${maven.ui.navcol.foreground}"/>
<filter token="UI_NAVCOL_BACKGROUND_NS4"
value="${maven.ui.navcol.background.ns4}"/>
<filter token="UI_NAVCOL_FOREGROUND_NS4"
value="${maven.ui.navcol.foreground.ns4}"/>
<filter token="UI_NAVCOL_BORDER_TOP" value="${maven.ui.navcol.border.top}"/>
<filter token="UI_NAVCOL_BORDER_RIGHT"
value="${maven.ui.navcol.border.right}"/>
<filter token="UI_NAVCOL_BORDER_BOTTOM"
value="${maven.ui.navcol.border.bottom}"/>
<filter token="UI_BREADCRUMBS_BACKGROUND"
value="${maven.ui.breadcrumbs.background}"/>
<filter token="UI_BREADCRUMBS_FOREGROUND"
value="${maven.ui.breadcrumbs.foreground}"/>
<filter token="UI_BREADCRUMBS_BORDER_TOP"
value="${maven.ui.breadcrumbs.border.top}"/>
<filter token="UI_BREADCRUMBS_BORDER_BOTTOM"
value="${maven.ui.breadcrumbs.border.bottom}"/>
<filter token="UI_HREF_LINK" value="${maven.ui.href.link}"/>
<filter token="UI_HREF_LINK_ACTIVE" value="${maven.ui.href.link.active}"/>
<filter token="UI_HREF_LINK_SELFREF" value="${maven.ui.href.link.selfref}"/>
</filterset>
</copy>
<!-- Copy user supplied stylesheets, can override maven -->
<copy todir="${maven.docs.dest}/style" filtering="no">
<fileset dir="${maven.docs.src}/stylesheets">
<include name="**/*.css"/>
</fileset>
</copy>
</goal>
<goal
name="fo"
prereqs="do-fo"
description="o Generate XSL:FO project documentation"/>
<goal name="do-fo">
<mkdir dir="${maven.docs.dest}"/>
<java classname="org.apache.xalan.xslt.Process" fork="yes">
<classpath>
<pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
<pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
<pathelement location="${lib.repo}/xalan-2.1.0.jar"/>
</classpath>
<arg value="-in"/>
<!-- FIXME: Using ${maven.docs.src} here causes the build to fail because
xalan constructs the path relative to the current directory
even if it is an absolute path. -->
<arg value="xdocs/navigation.xml"/>
<arg value="-out"/>
<arg value="${maven.docs.dest}/project.fo"/>
<arg value="-xsl"/>
<arg value="${maven.home}/stylesheets/project2fo.xslt"/>
<arg value="-param"/>
<arg value="basePath"/>
<arg value="${maven.docs.src}"/>
</java>
</goal>
<goal
name="pdf"
prereqs="fo, do-pdf"
description="o Generate PDF project documentation"/>
<goal name="do-pdf">
<java classname="org.apache.fop.apps.Fop" fork="yes">
<classpath>
<pathelement location="${lib.repo}/fop-0.20.3.jar"/>
<pathelement location="${lib.repo}/batik.jar"/>
<pathelement location="${lib.repo}/logkit-1.0.jar"/>
<pathelement location="${lib.repo}/avalon-framework-4.0.jar"/>
<pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
</classpath>
<arg line="-fo ${maven.docs.dest}/project.fo -pdf
${maven.docs.dest}/project.pdf"/>
</java>
</goal>
<!-- ================================================================== -->
<!-- S I T E -->
<!-- ================================================================== -->
<goal
name="site"
prereqs="do-site, post-site-callback"
/>
<goal
name="do-site"
prereqs="docs,javadocs,cross-ref"
/>
<!-- ================================================================== -->
<!-- D E P L O Y S I T E -->
<!-- ================================================================== -->
<goal
name="check-maven-username">
<!--
unless="maven.username">
Not sure if there's an unless jelly tag or what syntax I need
to test for null.
-->
<fail>
+------------------------------------------------------------------
| ERROR!
|
| You must specify a maven username in order to deploy the site!
| You can either set this property in your ~/build.properties
| or specify one on the command line:
|
| ant -Dmaven.username=${user.name} maven:deploy-site
+------------------------------------------------------------------
</fail>
</goal>
<goal
name="deploy-site"
prereqs="check-maven-username, site,do-deploy-site"
/>
<goal
name="do-deploy-site">
<j:if test="${flags.mavenUserName}">
<echo>
siteAddress = ${maven.siteAddress}
siteDirectory = ${maven.siteDirectory}
</echo>
<!-- This needs to taken from the project properties -->
<property name="maven.homepage" value="${maven.siteDirectory}"/>
<tar tarfile="${maven.final.name}-site.tar" basedir="${maven.docs.dest}"/>
<gzip zipfile="${maven.final.name}-site.tar.gz"
src="${maven.final.name}-site.tar"/>
<delete file="${maven.final.name}-site.tar"/>
<exec dir="." executable="${maven.scp.executable}">
<arg value="${maven.final.name}-site.tar.gz"/>
<arg value="${maven.username}@${maven.siteAddress}:${maven.homepage}"/>
</exec>
<exec dir="." executable="${maven.ssh.executable}">
<arg line="${maven.siteAddress} -l ${maven.username} 'mkdir -p
${maven.homepage};cd ${maven.homepage};gunzip ${maven.final.name}-site.tar.gz;tar xUvf
${maven.final.name}-site.tar;chmod -R g+u *;rm ${maven.final.name}-site.tar'"/>
</exec>
<delete file="${maven.final.name}-site.tar.gz"/>
</j:if>
</goal>
</project>
1.1
jakarta-turbine-maven/src/templates/build/plugins/docbook/plugin.properties
Index: plugin.properties
===================================================================
# -------------------------------------------------------------------
# P L U G I N P R O P E R I E S
# -------------------------------------------------------------------
# Simple docbook plugin.
# -------------------------------------------------------------------
maven.build.dir = ${basedir}/target
maven.docs.src = ${basedir}/xdocs
maven.docs.dest = ${maven.build.dir}/docs
maven.docs.outputencoding = ISO-8859-1
maven.gen.docs = ${maven.build.dir}/generated-xdocs
maven.src.docbook-simple=${maven.src.dir}/sdocbook
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>