PR: MPFAQ-13
fix CDATA handling git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115558 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
60dbf5c2ff
commit
3ac04823c2
@ -66,8 +66,6 @@
|
||||
</ant:fileset>
|
||||
</ant:fileScanner>
|
||||
|
||||
<j:set var="outputencoding" value="${maven.docs.outputencoding}"/>
|
||||
|
||||
<!-- loop each found .fml file and produce output .xml xdocs file -->
|
||||
<j:forEach var="faqFile" items="${faqFilenames.iterator()}">
|
||||
<!-- first, create the relative output-dir into the destdir -->
|
||||
@ -82,62 +80,15 @@
|
||||
|
||||
<echo>Generating ${outFile} from ${faqFile}</echo>
|
||||
|
||||
<!-- xml-parse .fml faq file -->
|
||||
<x:parse var="doc" xml="${faqFile}"/>
|
||||
<x:set var="root" select="$doc/*"/>
|
||||
|
||||
<!-- produce a output xdoc xml file from parsed .fml source -->
|
||||
<j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml" escapeText="true">
|
||||
<document>
|
||||
|
||||
<properties>
|
||||
<x:element name="title"><x:expr select="$root/@title"/></x:element>
|
||||
</properties>
|
||||
<body>
|
||||
<x:element name="section">
|
||||
<x:attribute name="name"><x:expr select="$root/@title"/></x:attribute>
|
||||
|
||||
<x:forEach select="$root/part">
|
||||
<p>
|
||||
<strong><x:expr select="title"/></strong>
|
||||
</p>
|
||||
<ol>
|
||||
<x:forEach select="faq">
|
||||
<li>
|
||||
<x:element name="a">
|
||||
<j:set var="_id"><x:expr select="@id"/></j:set>
|
||||
<x:attribute name="href">#<doc:escapeNameToken value="${_id}"/></x:attribute>
|
||||
<x:copyOf select="question/node()"/>
|
||||
</x:element>
|
||||
</li>
|
||||
</x:forEach>
|
||||
</ol>
|
||||
</x:forEach>
|
||||
</x:element>
|
||||
|
||||
<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">
|
||||
<j:set var="_id"><x:expr select="@id"/></j:set>
|
||||
<x:attribute name="name"><doc:escapeNameToken value="${_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>
|
||||
<doc:jslFile
|
||||
input="${faqFile}"
|
||||
output="${outFile}"
|
||||
stylesheet="${plugin.resources}/faq.jsl"
|
||||
outputMode="xml"
|
||||
omitXmlDeclaration="false"
|
||||
prettyPrint="false"
|
||||
/>
|
||||
</j:forEach>
|
||||
</util:available>
|
||||
</define:tag>
|
||||
|
||||
100
faq/src/plugin-resources/faq.jsl
Normal file
100
faq/src/plugin-resources/faq.jsl
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
* ========================================================================
|
||||
*
|
||||
* Copyright 2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* ========================================================================
|
||||
-->
|
||||
<!-- stylesheet to be used -->
|
||||
<jsl:stylesheet select="$doc"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:jsl="jelly:jsl"
|
||||
xmlns:x="jelly:xml"
|
||||
xmlns:doc="doc"
|
||||
xmlns="dummy"
|
||||
trim="true">
|
||||
<jsl:template match="faqs" trim="false">
|
||||
<j:set var="title"><x:expr select="@title" /></j:set>
|
||||
<document>
|
||||
<properties>
|
||||
<title>${title}</title>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="${title}">
|
||||
<x:forEach select="part">
|
||||
<p>
|
||||
<strong><x:expr select="title"/></strong>
|
||||
</p>
|
||||
<ol>
|
||||
<x:forEach select="faq">
|
||||
<li>
|
||||
<j:set var="_id"><x:expr select="@id"/></j:set>
|
||||
<j:set var="_id">#<doc:escapeNameToken value="${_id}"/></j:set>
|
||||
<a href="${_id}">
|
||||
<x:copyOf select="question/node()"/>
|
||||
</a>
|
||||
</li>
|
||||
</x:forEach>
|
||||
</ol>
|
||||
</x:forEach>
|
||||
</section>
|
||||
|
||||
<jsl:applyTemplates trim="true" />
|
||||
</body>
|
||||
</document>
|
||||
</jsl:template>
|
||||
|
||||
<jsl:template match="part">
|
||||
<j:set var="name"><x:expr select="title" /></j:set>
|
||||
<section name="${name}">
|
||||
<jsl:applyTemplates trim="true" />
|
||||
</section>
|
||||
</jsl:template>
|
||||
|
||||
<jsl:template match="faq">
|
||||
<dl>
|
||||
<jsl:applyTemplates trim="true" />
|
||||
</dl>
|
||||
</jsl:template>
|
||||
|
||||
<jsl:template match="question">
|
||||
<dt>
|
||||
<j:set var="_id"><x:expr select="../@id"/></j:set>
|
||||
<j:set var="_id"><doc:escapeNameToken value="${_id}"/></j:set>
|
||||
<a name="${_id}">
|
||||
<jsl:applyTemplates trim="true" />
|
||||
</a>
|
||||
</dt>
|
||||
</jsl:template>
|
||||
|
||||
<jsl:template match="answer">
|
||||
<dd>
|
||||
<jsl:applyTemplates trim="true" />
|
||||
</dd>
|
||||
</jsl:template>
|
||||
|
||||
<!-- copy any other elements through -->
|
||||
<jsl:template match="*" trim="false"><jsl:copy trim="true"><jsl:applyTemplates trim="true"/></jsl:copy></jsl:template>
|
||||
|
||||
<!-- element values don't pass through as text -->
|
||||
<jsl:template match="@*"/>
|
||||
|
||||
<!-- CDATA and text nodes pass-thru -->
|
||||
<jsl:template match="text()"><x:expr select="."/></jsl:template>
|
||||
|
||||
</jsl:stylesheet>
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="1.4-SNAPSHOT" date="in CVS">
|
||||
<action dev="brett" type="fix" issue="MPFAQ-13">Correctly pass through CDATA content</action>
|
||||
<action dev="brett" type="fix" issue="MPFAQ-12">Make sure maven.faq.src exists to avoid exceptions</action>
|
||||
</release>
|
||||
<release version="1.3" date="2004-05-15">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user