MPXDOC-87: Make xdoc:validate work

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@290361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2005-09-20 04:58:36 +00:00
parent 47ea8bae72
commit 6127a69571
7 changed files with 112 additions and 24 deletions

View File

@ -30,6 +30,7 @@
xmlns:ant="jelly:ant"
xmlns:fmt="jelly:fmt"
xmlns:doc="doc"
xmlns:plugin="plugin"
xmlns:xdoc="jelly:org.apache.maven.xdoc.XdocTagLibrary">
<j:new var="reports" className="java.util.ArrayList"/>
@ -729,34 +730,85 @@
</j:forEach>
</goal>
<!-- ================================================================== -->
<!-- V A L I D A T E N A V I G A T I O N F I L E -->
<!-- ================================================================== -->
<goal name="xdoc:navigation-validate"
description="Validate navigation file">
<available
file="${maven.docs.src}/${maven.xdoc.navigation.file}"
property="navigationFile.available"/>
<j:if test="${navigationFile.available}">
<maven:get plugin="maven-xdoc-plugin" property="plugin" var="installedPlugin" />
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${installedPlugin.currentVersion.endsWith('-SNAPSHOT')}">
<j:set var="currentRelease" value="${installedPlugin.currentVersion.substring(0,pom.currentVersion.length()-9)}"/>
</j:when>
<j:otherwise>
<j:set var="currentRelease" value="${installedPlugin.currentVersion}"/>
</j:otherwise>
</j:choose>
<plugin:validate-xml
schema="${plugin.resources}/xsd/maven-navigation-${currentRelease}.xsd"
file="${maven.docs.src}/${maven.xdoc.navigation.file}"/>
</j:if>
</goal>
<!-- ================================================================== -->
<!-- V A L I D A T E X D O C S -->
<!-- ================================================================== -->
<!-- validate xdocs -->
<goal name="xdoc:validate" prereqs="pom:taglib"
<goal name="xdoc:validate" prereqs="xdoc:navigation-validate"
description="Validate xdocs match the schema">
<available file="${maven.docs.src}" type="dir"
property="maven.docs.src.available"/>
<j:if test="${maven.docs.src.available}">
<fileScanner var="navFiles">
<fileScanner var="xmlFiles">
<fileset dir="${maven.docs.src}">
<patternset>
<include name="**/${maven.xdoc.navigation.file}"/>
<include name="**/*.xml"/>
<exclude name="**/${maven.xdoc.navigation.file}" />
<util:tokenize var="files" delim=",">${maven.xdoc.validate.exclude}</util:tokenize>
<j:forEach var="pattern" items="${files}">
<exclude name="${pattern}" />
</j:forEach>
<util:tokenize var="files" delim=",">${maven.xdoc.xml.copy}</util:tokenize>
<j:forEach var="pattern" items="${files}">
<exclude name="${pattern}" />
</j:forEach>
</patternset>
</fileset>
</fileScanner>
<j:forEach var="file" items="${navFiles.iterator()}">
<echo>Validating ${file}</echo>
<pom:validate validator="${maven.home}/maven-navigation-1.0.xsd"
projectDescriptor="${file}"/>
<maven:get plugin="maven-xdoc-plugin" property="plugin" var="installedPlugin" />
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${installedPlugin.currentVersion.endsWith('-SNAPSHOT')}">
<j:set var="currentRelease" value="${installedPlugin.currentVersion.substring(0,pom.currentVersion.length()-9)}"/>
</j:when>
<j:otherwise>
<j:set var="currentRelease" value="${installedPlugin.currentVersion}"/>
</j:otherwise>
</j:choose>
<j:forEach var="file" items="${xmlFiles.iterator()}">
<plugin:validate-xml
schema="${plugin.resources}/dtd/maven-xdoc-${currentRelease}.dtd"
file="${file}"/>
</j:forEach>
</j:if>
</goal>
<!-- ================================================================== -->
<!-- C O P Y R E S O U R C E S -->
<!-- ================================================================== -->

View File

@ -80,6 +80,10 @@ maven.xdoc.copy.excludes=file.gif,folder-closed.gif,folder-open.gif,icon_alert.g
# Files not copied unless skin is classic
maven.xdoc.copy.excludes.classic=external-classic.png,help_logo.gif,icon_arrowfolderclosed1_sml.gif,icon_arrowwaste1_sml.gif,icon_arrowwaste2_sml.gif,icon_doc_lrg.gif,icon_doc_sml.gif,icon_error_lrg.gif,icon_folder_lrg.gif,icon_folder_sml.gif,icon_help_sml.gif,icon_info_lrg.gif,icon_members_lrg.gif,icon_sortdown.gif,icon_sortup.gif,icon_success_lrg.gif,icon_usergroups_lrg.gif,icon_arrowfolderopen2_sml.gif,icon_warning_lrg.gif,newwindow-classic.png,nw_maj_rond.gif,strich.gif,sw_maj_rond.gif,sw_med_rond.gif
# List of xml files (or patterns) to exclude from validation
# Note that navigation.xml and ${maven.xdoc.xml.copy} are included implicitly
maven.xdoc.validate.exclude=changes.xml
#
# I18N Preferences
#

View File

@ -2,20 +2,25 @@
<!ENTITY % XHTML SYSTEM "xhtml1-transitional.ent">
%XHTML;
<!ELEMENT document (properties, body)>
<!ELEMENT properties (title, author)>
<!ATTLIST document
xmlns CDATA #FIXED ""
>
<!ELEMENT properties (title, author*)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT author (#PCDATA)>
<!ATTLIST author
email CDATA #REQUIRED
>
<!ELEMENT body (section)>
<!ELEMENT section (subsection+)>
<!ELEMENT body (section+)>
<!ELEMENT section (subsection | p | ul | ol | source | div | table)+>
<!ATTLIST section
name CDATA #REQUIRED
id CDATA #IMPLIED
>
<!ELEMENT subsection (p | ul | source)+>
<!ELEMENT subsection (p | ul | ol | source | div | table)+>
<!ATTLIST subsection
name CDATA #REQUIRED
id CDATA #IMPLIED
>
<!ELEMENT escapeXml ANY>
<!ELEMENT source (#PCDATA | escapeXml)*>

View File

@ -21,7 +21,6 @@
<xs:complexType>
<xs:sequence>
<xs:element ref="title"/>
<xs:element ref="head" minOccurs="0"/>
<xs:element ref="body"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
@ -36,16 +35,20 @@
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="head"/>
<xs:element name="body">
<xs:complexType>
<xs:sequence>
<xs:element ref="breadcrumbs" minOccurs="0"/>
<xs:element ref="links" minOccurs="0"/>
<xs:element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="search" minOccurs="0"/>
<xs:element ref="powered-by" minOccurs="0"/>
<xs:element ref="footer" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="search"/>
<xs:element name="footer"/>
<xs:element name="links">
<xs:complexType>
<xs:sequence>
@ -72,6 +75,13 @@
Values - left-header (default), left-footer -->
</xs:complexType>
</xs:element>
<xs:element name="powered-by">
<xs:complexType>
<xs:sequence>
<xs:element ref="item" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="item">
<xs:complexType>
<xs:sequence>

View File

@ -27,6 +27,7 @@
</properties>
<body>
<release version="1.10" date="in SVN">
<action dev="ltheussl" type="fix" issue="MPXDOC-87">Fix <code>xdoc:validate</code>.</action>
<action dev="ltheussl" type="fix" issue="MPXDOC-106" due-to="Jerome Lacoste">One cannot call xdoc:copy-user-resources directly.</action>
<action dev="ltheussl" type="add" issue="MPXDOC-126" due-to="Maarten Coene">Add support for more powered-by banners.</action>
<action dev="ltheussl" type="add" issue="MPXDOC-80" due-to="Joerg Schaible">Support global theme.</action>

View File

@ -44,10 +44,15 @@
</description>
</goal>
<goal>
<name>init-dvsl-tag</name>
<name>xdoc:validate</name>
<description>
This goal defines the <code>DVSL</code> tag library for generating
documentation. A single tag <code>dvsl:dvsl</code> is defined.
Validates the user xdoc documents.
</description>
</goal>
<goal>
<name>xdoc:navigation-validate</name>
<description>
Validates the navigation file ${maven.xdoc.navigation.file}.
</description>
</goal>
<goal>

View File

@ -91,6 +91,17 @@
using a non-classic theme.
</td>
</tr>
<tr>
<td>maven.xdoc.validate.exclude</td>
<td>Yes</td>
<td>
A comma separated list of patterns to specify xml documents that
are to be excluded in <code>xdoc:validate</code>. This defaults to
<code>${maven.xdoc.navigation.file}</code>,
<code>${maven.xdoc.xml.copy}</code>,
<code>changes.xml</code>.
</td>
</tr>
</table>
</section>
<section name="Localization Properties">