You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by lt...@apache.org on 2005/10/24 01:45:30 UTC
svn commit: r327884 - in /maven/maven-1/plugins/trunk/xdoc: ./
src/plugin-resources/ src/plugin-resources/templates/
src/plugin-resources/xsd/ src/plugin-test/test04/xdocs/ src/xsd/ xdocs/
xdocs/reference/
Author: ltheussl
Date: Sun Oct 23 16:45:23 2005
New Revision: 327884
URL: http://svn.apache.org/viewcvs?rev=327884&view=rev
Log:
MPXDOC-164: Add a sitemap
Added:
maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/sitemap.jsl
Modified:
maven/maven-1/plugins/trunk/xdoc/plugin.jelly
maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates.properties
maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_de.properties
maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_fr.properties
maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/xsd/maven-navigation-1.10.xsd
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/navigation.xml
maven/maven-1/plugins/trunk/xdoc/src/xsd/maven-navigation.xsd
maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml
maven/maven-1/plugins/trunk/xdoc/xdocs/goals.xml
maven/maven-1/plugins/trunk/xdoc/xdocs/navigation.xml
maven/maven-1/plugins/trunk/xdoc/xdocs/reference/navfile.xml
Modified: maven/maven-1/plugins/trunk/xdoc/plugin.jelly
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/plugin.jelly?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/plugin.jelly (original)
+++ maven/maven-1/plugins/trunk/xdoc/plugin.jelly Sun Oct 23 16:45:23 2005
@@ -719,6 +719,11 @@
</j:choose>
</j:forEach>
+ <!-- Generate sitemap -->
+ <j:if test="${!nav.sitemap.isEmpty()}">
+ <attainGoal name="xdoc:sitemap-noinit"/>
+ </j:if>
+
<!-- Copy all generated files in an internationalize site structure, ie:
|__ en\
|__ index.xml
@@ -748,6 +753,41 @@
</j:forEach>
</goal>
+ <!-- ================================================================== -->
+ <!-- S I T E M A P -->
+ <!-- ================================================================== -->
+
+ <goal name="xdoc:sitemap"
+ prereqs="xdoc:init, xdoc:i18n-validation, xdoc:register-reports, xdoc:sitemap-noinit"
+ description="Generate a sitemap">
+ </goal>
+
+
+ <goal name="xdoc:sitemap-noinit"
+ description="Generate a sitemap">
+
+ <util:available file="${maven.docs.src}/${maven.xdoc.navigation.file}">
+ <util:file var="tempnav" name="${maven.build.dir}/project-nav.xml"/>
+ <j:file name="${tempnav.toString()}" outputMode="xml">
+ <j:import file="${plugin.resources}/navigation.jelly" inherit="true"/>
+ </j:file>
+ <x:parse var="projectNavRoot" xml="${tempnav}"/>
+ <x:set var="projectNav" select="$projectNavRoot/project"/>
+ <fmt:setBundle basename="plugin-resources.templates.templates" var="msg"/>
+ <!-- User bundle -->
+ <!-- Goal grabClassLoader should be call first -->
+ <xdoc:grabClassLoader resource="${maven.xdoc.bundle.src}"/>
+ <fmt:setBundle basename="${maven.xdoc.bundle}" var="myMsg"/>
+ <doc:jsl
+ input="${maven.docs.src}/${maven.xdoc.navigation.file}"
+ output="sitemap.xml"
+ stylesheet="${plugin.resources}/sitemap.jsl"
+ encoding="${maven.docs.outputencoding}"
+ outputMode="xml"
+ prettyPrint="true" />
+ </util:available>
+
+ </goal>
<!-- ================================================================== -->
<!-- V A L I D A T E N A V I G A T I O N F I L E -->
Added: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/sitemap.jsl
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/sitemap.jsl?rev=327884&view=auto
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/sitemap.jsl (added)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/sitemap.jsl Sun Oct 23 16:45:23 2005
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2005 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.
+ */
+ -->
+
+<jsl:stylesheet
+ select="$doc"
+ xmlns:j="jelly:core"
+ xmlns:jsl="jelly:jsl"
+ xmlns:x="jelly:xml"
+ xmlns:fmt="jelly:fmt"
+ xmlns:util="jelly:util"
+ xmlns:doc="doc"
+ xmlns="dummy" trim="false">
+
+ <jsl:template match="project">
+ <document>
+ <properties>
+ <title key="sitemap.title"
+ bundle="plugin-resources.templates.templates" >
+ <message key="sitemap.title"
+ bundle="plugin-resources.templates.templates" />
+ </title>
+ </properties>
+ <body>
+ <j:set var="name"><x:expr select="@name"/></j:set>
+ <section key="sitemap.section.title"
+ bundle="plugin-resources.templates.templates"
+ name="Sitemap">
+ <jsl:applyTemplates select="body/menu"/>
+ <jsl:applyTemplates select="$projectNav/body/menu"/>
+ </section>
+ </body>
+ </document>
+ </jsl:template>
+
+ <jsl:template match="menu" trim="true">
+ <x:set var="currentMenu" select="." />
+ <div id="navcolumn">
+ <x:if select="$currentMenu/@name and not($currentMenu/@key)">
+ <h5><x:expr select="string(@name)"/></h5>
+ </x:if>
+ <x:if select="$currentMenu/@key">
+ <j:set var="_key"><x:expr select="@key"/></j:set>
+ <j:set var="_bundle"><x:expr select="@bundle"/></j:set>
+ <h5>
+ <j:if test="${!empty(_bundle)}">
+ <message key="${_key}" bundle="${_bundle}"/>
+ </j:if>
+ <j:if test="${empty(_bundle)}">
+ <message key="${_key}"/>
+ </j:if>
+ </h5>
+ </x:if>
+ <ul><jsl:applyTemplates select="item"/></ul>
+ </div>
+ </jsl:template>
+
+ <jsl:template match="item">
+ <x:set var="currentItem" select="." />
+ <x:set var="description" select="null" asString="true"/>
+ <j:set var="link"><x:expr select="@href"/></j:set>
+ <j:if test="${link.startsWith('/')}" trim="yes">
+ <j:set var="link" value="${link.substring(1)}"/>
+ </j:if>
+ <util:replace value="${link}" var="xml_link" old=".html" new=".xml"/>
+ <util:available file="${maven.docs.src}/${xml_link}">
+ <util:file var="xmlfile" name="${maven.docs.src}/${xml_link}"/>
+ <x:parse var="inputdoc" xml="${xmlfile}"/>
+ <x:set
+ var="description"
+ select="$inputdoc//meta[@name = 'description']/@content"
+ asString="true"/>
+ </util:available>
+ <j:set var="collapse"><x:expr select="@collapse"/></j:set>
+ <j:choose>
+ <j:when test="${collapse != 'true'}">
+ <li class="none">
+ <x:if select="$currentItem/@name and not($currentItem/@key)">
+ <a href="${link}"><x:expr select="@name"/></a> ${description}
+ </x:if>
+ <x:if select="$currentItem/@key">
+ <j:set var="_key"><x:expr select="@key"/></j:set>
+ <j:set var="_bundle"><x:expr select="@bundle"/></j:set>
+ <a href="${link}">
+ <j:if test="${!empty(_bundle)}">
+ <message key="${_key}" bundle="${_bundle}"/>
+ </j:if>
+ <j:if test="${empty(_bundle)}">
+ <message key="${_key}" />
+ </j:if>
+ </a> ${description}
+ </x:if>
+ </li>
+ </j:when>
+ <j:otherwise>
+ <li class="expanded">
+ <x:if select="$currentItem/@name and not($currentItem/@key)">
+ <a href="${link}"><x:expr select="@name"/></a> ${description}
+ </x:if>
+ <x:if select="$currentItem/@key">
+ <j:set var="_key"><x:expr select="@key"/></j:set>
+ <j:set var="_bundle"><x:expr select="@bundle"/></j:set>
+ <a href="${link}">
+ <j:if test="${!empty(_bundle)}">
+ <message key="${_key}" bundle="${_bundle}"/>
+ </j:if>
+ <j:if test="${empty(_bundle)}">
+ <message key="${_key}" />
+ </j:if>
+ </a> ${description}
+ </x:if>
+ <ul>
+ <jsl:applyTemplates select="item"/>
+ </ul>
+ </li>
+ </j:otherwise>
+ </j:choose>
+ </jsl:template>
+
+ <jsl:template match="*">
+ <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>
Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates.properties?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates.properties (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates.properties Sun Oct 23 16:45:23 2005
@@ -167,3 +167,7 @@
site.navbar.previous=previous
site.navbar.home=home
site.navbar.next=next
+
+# For sitemap.jsl
+sitemap.title=Sitemap
+sitemap.section.title=Sitemap
Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_de.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_de.properties?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_de.properties (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_de.properties Sun Oct 23 16:45:23 2005
@@ -169,3 +169,7 @@
site.navbar.previous=zurück
site.navbar.home=Übersicht
site.navbar.next=weiter
+
+# For sitemap.jsl
+sitemap.title=Site Map
+sitemap.section.title=Site Map
Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_fr.properties
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_fr.properties?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_fr.properties (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/templates/templates_fr.properties Sun Oct 23 16:45:23 2005
@@ -169,3 +169,7 @@
site.navbar.previous=précédent
site.navbar.home=Accueil
site.navbar.next=suivant
+
+# For sitemap.jsl
+sitemap.title=Plan du site
+sitemap.section.title=Plan du site
Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/xsd/maven-navigation-1.10.xsd
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/xsd/maven-navigation-1.10.xsd?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/xsd/maven-navigation-1.10.xsd (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/xsd/maven-navigation-1.10.xsd Sun Oct 23 16:45:23 2005
@@ -40,6 +40,7 @@
<xs:sequence>
<xs:element ref="breadcrumbs" minOccurs="0"/>
<xs:element ref="links" minOccurs="0"/>
+ <xs:element ref="sitemap" minOccurs="0"/>
<xs:element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="search" minOccurs="0"/>
<xs:element ref="powered-by" minOccurs="0"/>
@@ -47,6 +48,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="sitemap"/>
<xs:element name="search"/>
<xs:element name="footer"/>
<xs:element name="links">
Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/navigation.xml?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/navigation.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/navigation.xml Sun Oct 23 16:45:23 2005
@@ -30,14 +30,14 @@
img="images/pdf.gif"/>
-->
</links>
-
+ <sitemap/>
<!-- project overview -->
<menu key="navigation.menu1.title">
<item key="navigation.menu1.item1"
href="/myfile_i18n.html" />
- <item key="navigation.menu1.item2"
- href="/subdir/testjsltosite.html" />
- <item key="navigation.menu1.item3"
+ <item key="navigation.menu1.item2"
+ href="/subdir/testjsltosite.html" />
+ <item key="navigation.menu1.item3"
href="/subdir/subdir2/testjsltosite2.html" />
</menu>
</body>
Modified: maven/maven-1/plugins/trunk/xdoc/src/xsd/maven-navigation.xsd
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/xsd/maven-navigation.xsd?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/xsd/maven-navigation.xsd (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/xsd/maven-navigation.xsd Sun Oct 23 16:45:23 2005
@@ -40,6 +40,7 @@
<xs:sequence>
<xs:element ref="breadcrumbs" minOccurs="0"/>
<xs:element ref="links" minOccurs="0"/>
+ <xs:element ref="sitemap" minOccurs="0"/>
<xs:element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="search" minOccurs="0"/>
<xs:element ref="powered-by" minOccurs="0"/>
@@ -47,6 +48,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+ <xs:element name="sitemap"/>
<xs:element name="search"/>
<xs:element name="footer"/>
<xs:element name="links">
Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml Sun Oct 23 16:45:23 2005
@@ -27,6 +27,7 @@
</properties>
<body>
<release version="1.10" date="in SVN">
+ <action dev="ltheussl" type="add" issue="MPXDOC-164">New goal <code>xdoc:sitemap</code> to generate a sitemap.</action>
<action dev="aheritier" type="update" issue="MAVEN-1712">Update dependencies to match ones in maven 1.1 core and to unify them between plugins. The following dependencies are updated :
<ul>
<li>commons-jelly v1.0-RC1 -> v1.0</li>
Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/goals.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/goals.xml?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/goals.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/goals.xml Sun Oct 23 16:45:23 2005
@@ -63,6 +63,14 @@
</description>
</goal>
<goal>
+ <name>xdoc:sitemap</name>
+ <description>
+ Generates a sitemap from the information found in the
+ navigation file ${maven.xdoc.navigation.file}.
+ See <a href="reference/navfile.html#Sitemap">Sitemap</a>.
+ </description>
+ </goal>
+ <goal>
<name>copy-user-bundles</name>
<description>
Copy user bundles in the XDOC plugin. Used for the i18n support.
Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/navigation.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/navigation.xml?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/navigation.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/navigation.xml Sun Oct 23 16:45:23 2005
@@ -30,7 +30,9 @@
<item name="Continuum" href="http://maven.apache.org/continuum/index.html"/>
<item name="Maven 2.0" href="http://maven.apache.org/"/>
<item name="Anakia Tags" href="http://jakarta.apache.org/site/jakarta-site2.html"/>
+ <item name="Sitemap" href="sitemap.html"/>
</links>
+ <sitemap/>
<menu name="Overview">
<item name="Goals" href="/goals.html"/>
<item name="Properties" href="/properties.html"/>
Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/reference/navfile.xml
URL: http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/reference/navfile.xml?rev=327884&r1=327883&r2=327884&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/reference/navfile.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/reference/navfile.xml Sun Oct 23 16:45:23 2005
@@ -20,6 +20,9 @@
<properties>
<title>Navigation</title>
</properties>
+ <head>
+ <meta name="description" content="Information on the navigation.xml file format"/>
+ </head>
<body>
<section name="The navigation file">
<p>
@@ -43,6 +46,7 @@
.
</links>
+ <sitemap/>
<menu name="Documentation">
.
@@ -73,6 +77,23 @@
<p>
A list of items that are displayed on the top left of the site.
Check the top of this page for an example.
+ </p>
+ </subsection>
+
+ <subsection name="Sitemap">
+ <p>
+ If a <code><sitemap/></code> element is found in the
+ <code>navigation.xml</code> body, a <code>sitemap.html</code>
+ file is generated. An optional description
+ is added for a page if a <code><meta></code> element is
+ found in the corresponding xdoc source document header:
+ </p>
+ <source><![CDATA[<head>
+ <meta name="description" content="Information on the navigation.xml file format"/>
+</head>]]></source>
+ <p>
+ See the <a href="../sitemap.html">sitemap</a>
+ of the current site for an example.
</p>
</subsection>