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
2005-10-23 23:45:23 +00:00
parent 41545b0f60
commit c598d79462
12 changed files with 241 additions and 4 deletions

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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

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">

View File

@@ -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>

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">