MPXDOC-131 : allow i18n links.

Patch submitted by : Ignacio G. Mac Dowell
Patch reviewed by : Arnaud Heritier

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@267494 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier committed 2005-09-03 20:45:41 +00:00
1 parent a1d3b8b82a
commit 38d31ed587
8 files changed
+52 -19

No files matched your search

+33 -11
View File
@@ -3,7 +3,7 @@
<!--
* ========================================================================
*
* Copyright 2005 The Apache Software Foundation.
* Copyright 2001-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.
@@ -514,9 +514,30 @@
<x:element name="a" trim="true">
<x:forEach var="attr" select="@*">
<j:choose>
<j:when test="${attr.name == 'href'}">
<j:set var="href" value="${attr.value}" />
<j:choose>
<j:set var="attr_name" value="${attr.name}"/>
<j:set var="attr_value" value="${attr.value}"/>
<j:if test="${attr_name == 'hrefkey'}">
<j:set var="_bundle">
<x:expr select="@bundle" />
</j:set>
<j:if test="${!empty(attr_value)}">
<!-- If there is hrefkey, then change attr_name to href -->
<!-- and attr_value to the formatted message -->
<j:set var="attr_name" value="href"/>
<!-- Default bundle is the user one in ${maven.xdoc.bundle} -->
<j:if test="${empty(_bundle)}">
<fmt:message key="${attr_value}" bundle="${myMsg}" var="attr_value"/>
</j:if>
<j:if test="${!empty(_bundle)}">
<fmt:bundle basename="${_bundle}">
<fmt:message key="${attr_value}" var="attr_value"/>
</fmt:bundle>
</j:if>
</j:if>
</j:if>
<j:when test="${attr_name == 'href'}">
<j:set var="href" value="${attr_value}" />
<j:choose>
<j:when test="${href.startsWith('#')}">
<x:attribute name="href">
<doc:escapeNameToken value="${href}"/>
@@ -526,27 +547,28 @@
<x:attribute name="href">${href}</x:attribute>
<x:attribute name="class">externalLink</x:attribute>
<x:attribute name="title">External Link</x:attribute>
</j:when>
</j:when>
<j:otherwise>
<x:attribute name="href">${href}</x:attribute>
</j:otherwise>
</j:choose>
</j:when>
<j:when test="${attr.name == 'target'}">
<j:set var="target">${attr.value}</j:set>
<j:when test="${attr_name == 'target'}">
<j:set var="target">${attr_value}</j:set>
<j:if test="${!empty(target) and target.equals('_blank')}">
<x:attribute name="class">newWindow</x:attribute>
<x:attribute name="title">New Window</x:attribute>
</j:if>
</j:if>
<x:attribute name="target">${target}</x:attribute>
</j:when>
<j:when test="${attr.name == 'name'}">
<j:when test="${attr_name == 'name'}">
<x:attribute name="name">
<doc:escapeNameToken value="${attr.value}"/>
<doc:escapeNameToken value="${attr_value}"/>
</x:attribute>
</j:when>
<j:when test="${attr.name == 'bundle'}"/>
<j:otherwise>
<x:attribute name="${attr.name}">${attr.value}</x:attribute>
<x:attribute name="${attr_name}">${attr_value}</x:attribute>
</j:otherwise>
</j:choose>
</x:forEach>
@@ -16,3 +16,6 @@ testjstltosite.title=test jslToSite tag
testjstltosite.section1.title=Title 1
testjstltosite.section1.description1=empty document
testjstltosite.section1.description2=This document is generated separately from other xdoc documents but should retain the site stylesheet and navigation.
testlinks.mysite1=http://mysite1.com
testlinks.mysite2=http://mysite2.com
@@ -16,3 +16,6 @@ testjstltosite.title=test jslToSite tag
testjstltosite.section1.title=Titre 1
testjstltosite.section1.description1=document vide
testjstltosite.section1.description2=Ce document est produit séparément des autres documents XDOC mais devrait maintenir le stylesheet et la navigation d'emplacement.
testlinks.mysite1=http://mysite1.fr
testlinks.mysite2=http://mysite2.fr
@@ -26,11 +26,11 @@
<body>
<section key="myfile_i18n.section1.title">
<p>
<message key="myfile_i18n.section1.description1"/>
<a hrefkey="testlinks.mysite1"><message key="myfile_i18n.section1.description1"/></a>
</p>
<p>
<message key="myfile_i18n.section1.description2"/>
<a hrefkey="testlinks.mysite2"><message key="myfile_i18n.section1.description2"/></a>
</p>
</section>
</body>
</document>
</document>
@@ -16,3 +16,6 @@ testjstltosite.title=test jslToSite tag
testjstltosite.section1.title=Title 1
testjstltosite.section1.description1=empty document
testjstltosite.section1.description2=This document is generated separately from other xdoc documents but should retain the site stylesheet and navigation.
testlinks.mysite1=http://mysite1.com
testlinks.mysite2=http://mysite2.com
@@ -16,3 +16,6 @@ testjstltosite.title=test jslToSite tag
testjstltosite.section1.title=Title 1
testjstltosite.section1.description1=document vide
testjstltosite.section1.description2=Ce document est produit séparément des autres documents XDOC mais devrait maintenir le stylesheet et la navigation d'emplacement.
testlinks.mysite1=http://mysite1.fr
testlinks.mysite2=http://mysite2.fr
+2 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
* Copyright 2001-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.
@@ -33,6 +33,7 @@
<action dev="aheritier" type="fix" issue="MPXDOC-151">i18n : menu tag in xdoc does not work with "key" translated text id.</action>
<action dev="aheritier" type="fix" issue="MPXDOC-147">Missing "Project Reports" header in the generated menu.</action>
<action dev="vsiveton" type="fix" issue="MPXDOC-148" due-to="Incze Lajos">Fixed bundles expression.</action>
<action dev="aheritier" type="add" issue="MPXDOC-131" due-to="Ignacio G. Mac Dowell">Allow i18n links.</action>
</release>
<release version="1.9.1" date="2005-06-16">
<action dev="brett" type="fix">Don't override the Maven library. This makes the plugin compatible with both Maven 1.0.2 and Maven 1.1</action>
+2 -4
View File
@@ -1,5 +1,4 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
@@ -17,13 +16,11 @@
* limitations under the License.
*/
-->
<document>
<properties>
<title>About</title>
<author email="vincent.siveton@gmail.com">Vincent Siveton</author>
</properties>
<body>
<section name="Internationalization">
<p>
@@ -122,7 +119,8 @@ maven.xdoc.locale.supported=fr, de</pre>
<title key="mykey"/>
<message key="mykey"/>
<section key="mykey"/>
<subsection key="mykey"/>]]></source>
<subsection key="mykey"/>
<a hrefkey="myhrefkey">My i18n link</a>]]></source>
NOTE: XDoc plugin always uses key if defined. For instance,
this line of code: