Initial version of an FAQ plugin for generating an FAQ page from a simple XML document
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
3
faq/.cvsignore
Normal file
3
faq/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
target
|
||||
*.log
|
||||
|
||||
91
faq/plugin.jelly
Normal file
91
faq/plugin.jelly
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:x="jelly:xml"
|
||||
xmlns:html="jelly:html"
|
||||
xmlns:maven="jelly:maven"
|
||||
xmlns:log="jelly:log"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:doc="doc"
|
||||
xmlns:m="maven">
|
||||
|
||||
<goal name="faq"
|
||||
description="Generates an FAQ xdoc file from an FAQ XML document">
|
||||
|
||||
<j:set var="destfile" value="${maven.faq.dest.file}"/>
|
||||
<j:if test="${empty(destfile)}">
|
||||
<j:set var="destfile" value="${maven.build.dir}/generated-xdocs/faq.xml"/>
|
||||
</j:if>
|
||||
|
||||
<mkdir dir="${maven.build.dir}/generated-xdocs"/>
|
||||
|
||||
<j:set var="srcfile" value="${maven.faq.src.file}"/>
|
||||
<j:if test="${empty(srcfile)}">
|
||||
<j:set var="srcfile" value="xdocs/faq.fml"/>
|
||||
</j:if>
|
||||
|
||||
<util:file var="srcfileFile" name="${srcfile}"/>
|
||||
<j:set var="srcfile" value="${srcfileFile.getCanonicalPath()}"/>
|
||||
<util:file var="destfileFile" name="${destfile}"/>
|
||||
<j:set var="destfile" value="${destfileFile.getCanonicalPath()}"/>
|
||||
|
||||
<j:set var="outputencoding" value="${maven.docs.outputencoding}"/>
|
||||
|
||||
<x:parse var="doc" xml="${srcfileFile}"/>
|
||||
<x:set var="root" select="$doc/*"/>
|
||||
|
||||
<j:file name="${destfile}" encoding="${outputencoding}"
|
||||
omitXmlDeclaration="true" outputMode="xml"
|
||||
prettyPrint="true">
|
||||
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title><x:expr select="$root/title"/></title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="Frequently Asked Questions">
|
||||
<x:forEach select="$root/part">
|
||||
<p>
|
||||
<strong><x:expr select="title"/></strong>
|
||||
</p>
|
||||
<ol>
|
||||
<x:forEach select="faq">
|
||||
<li>
|
||||
<x:element name="a">
|
||||
<x:attribute name="href">#<x:expr select="@id"/></x:attribute>
|
||||
<x:copyOf select="question/node()"/>
|
||||
</x:element>
|
||||
</li>
|
||||
</x:forEach>
|
||||
</ol>
|
||||
</x:forEach>
|
||||
</section>
|
||||
|
||||
|
||||
<x:forEach select="$root/part">
|
||||
<x:element name="section">
|
||||
<x:attribute name="name"><x:expr select="title"/></x:attribute>
|
||||
|
||||
<x:forEach select="faq">
|
||||
<dl>
|
||||
<dt>
|
||||
<x:element name="a">
|
||||
<x:attribute name="href"><x:expr select="@id"/></x:attribute>
|
||||
<x:copyOf select="question/node()"/>
|
||||
</x:element>
|
||||
</dt>
|
||||
<dd>
|
||||
<x:copyOf select="answer/node()"/>
|
||||
</dd>
|
||||
</dl>
|
||||
</x:forEach>
|
||||
</x:element>
|
||||
</x:forEach>
|
||||
</body>
|
||||
</document>
|
||||
</j:file>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
64
faq/project.xml
Normal file
64
faq/project.xml
Normal file
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project>
|
||||
<extend>${basedir}/../project.xml</extend>
|
||||
<pomVersion>3</pomVersion>
|
||||
<id>maven-faq-plugin</id>
|
||||
<name>Maven FAQ Plug-in</name>
|
||||
<currentVersion>1.0</currentVersion>
|
||||
<!-- Gump integration -->
|
||||
|
||||
<gumpRepositoryId>jakarta</gumpRepositoryId>
|
||||
<description>Creates XDoc documentation from an FAQ XML document.</description>
|
||||
<shortDescription/>
|
||||
<url>http://jakarta.apache.org/turbine/maven/reference/plugins/faq/</url>
|
||||
|
||||
<siteDirectory>/www/jakarta.apache.org/turbine/maven/reference/plugins/faq/</siteDirectory>
|
||||
|
||||
<repository>
|
||||
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-turbine-maven/src/plugins-build/faq/</connection>
|
||||
<url>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/src/plugins-build/faq/</url>
|
||||
</repository>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>James Strachan</name>
|
||||
<id>jstrachan</id>
|
||||
<email>jstrachan@apache.org</email>
|
||||
<organization>SpiritSoft, Inc.</organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-jelly</groupId>
|
||||
<artifactId>commons-jelly-tags-xml</artifactId>
|
||||
<version>20030211.142705</version>
|
||||
<url>http://jakarta.apache.org/commons/jelly/tags/xml/</url>
|
||||
<properties>
|
||||
<classloader>root.maven</classloader>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<!-- core dependencies which i'd have thought Maven introduced -->
|
||||
<dependency>
|
||||
<id>dom4j</id>
|
||||
<version>1.4-dev-8</version>
|
||||
<url>http://www.dom4j.org/</url>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<id>xml-apis</id>
|
||||
<version>1.0.b2</version>
|
||||
<url>http://xml.apache.org/xerces2-j/</url>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<id>xerces</id>
|
||||
<version>2.2.1</version>
|
||||
<url>http://xml.apache.org/xerces2-j/</url>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
1
faq/xdocs/.cvsignore
Normal file
1
faq/xdocs/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
stylesheets
|
||||
25
faq/xdocs/goals.xml
Normal file
25
faq/xdocs/goals.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>FAQ Plugin Goals</title>
|
||||
<author email="jstrachan@apache.org">James Strachan</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Goals">
|
||||
<table>
|
||||
<tr><th>Goal</th><th>Description</th></tr>
|
||||
|
||||
<a name="faq" />
|
||||
<tr>
|
||||
<td>faq</td>
|
||||
<td>
|
||||
The default goal. This goal generates an xdoc document
|
||||
from an XML FAQ document.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
28
faq/xdocs/index.xml
Normal file
28
faq/xdocs/index.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>Maven FAQ Plug-in</title>
|
||||
<author email="jstrachan@apache.org">James Strachan</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="Maven FAQ Plug-in">
|
||||
<p>
|
||||
This plugin generates xdoc documentation from an XML FAQ document.
|
||||
</p>
|
||||
<p>
|
||||
The properties that allow you to customize the execution
|
||||
are documented <a href="properties.html">here</a>.
|
||||
</p>
|
||||
<p>
|
||||
To enable FAQ generation add the following to your maven.xml
|
||||
</p>
|
||||
<source>
|
||||
<preGoal name="xdoc:jelly-transform">
|
||||
<attainGoal name="faq"/>
|
||||
</preGoal>
|
||||
</source>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
16
faq/xdocs/navigation.xml
Normal file
16
faq/xdocs/navigation.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<project name="Maven FAQ Plugin">
|
||||
|
||||
<title>Maven FAQ Plugin</title>
|
||||
|
||||
<body>
|
||||
<links>
|
||||
<item name="Maven" href="http://jakarta.apache.org/turbine/maven/"/>
|
||||
<item name="Jelly" href="http://jakarta.apache.org/commons/jelly/"/>
|
||||
</links>
|
||||
<menu name="Overview">
|
||||
<item name="Goals" href="/goals.html" />
|
||||
<item name="Properties" href="/properties.html" />
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
30
faq/xdocs/properties.xml
Normal file
30
faq/xdocs/properties.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<title>FAQ Properties</title>
|
||||
<author email="jstrachan@apache.org">James Strachan</author>
|
||||
</properties>
|
||||
|
||||
<body>
|
||||
<section name="FAQ Settings">
|
||||
<table>
|
||||
<tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
|
||||
<tr>
|
||||
<td>maven.faq.src.file</td>
|
||||
<td>Yes (default=xdoc/faq.fml)</td>
|
||||
<td>
|
||||
Specifies the source FAQ document in XML format to be used to generate the FAQ
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.faq.dest.file</td>
|
||||
<td>Yes (default=target/generated-xdocs/faq.xml)</td>
|
||||
<td>
|
||||
Specifies the destination of the generated FAQ document
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
Reference in New Issue
Block a user