MPXDOC-164: Add a sitemap

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@327884 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl committed 2005-10-23 23:45:23 +00:00
1 parent 41545b0f60
commit c598d79462
12 files changed
+241 -4

No files matched your search

+40
View File
@@ -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 -->
+149
View File
@@ -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>
@@ -167,3 +167,7 @@ site.description=Description
site.navbar.previous=previous
site.navbar.home=home
site.navbar.next=next
# For sitemap.jsl
sitemap.title=Sitemap
sitemap.section.title=Sitemap
@@ -169,3 +169,7 @@ site.description=Beschreibung
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
@@ -169,3 +169,7 @@ site.description=Description
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
@@ -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">
@@ -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>
+2
View File
@@ -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">
+1
View File
@@ -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>
+8
View File
@@ -62,6 +62,14 @@
Validates the navigation file ${maven.xdoc.navigation.file}.
</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>
+2
View File
@@ -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"/>
+21
View File
@@ -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">
.
@@ -76,6 +80,23 @@
</p>
</subsection>
<subsection name="Sitemap">
<p>
If a <code>&lt;sitemap/&gt;</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>&lt;meta&gt;</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>
<subsection name="Menu">
<p>
The <code>&lt;menu&gt;</code> element takes an optional