Files
maven-plugins/changes/src/plugin-resources/changes.jsl
T

222 lines
8.9 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
* ========================================================================
*
* Copyright 2004 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:doc="doc"
xmlns:u="jelly:util"
xmlns:ant="jelly:ant"
xmlns="dummy" trim="false">
<jsl:template match="document">
<document>
<head>
<link rel="alternative" href="changes.rss" type="application/rss+xml" />
<x:forEach select="head/*">
<x:copyOf select="." />
</x:forEach>
</head>
<jsl:applyTemplates select="*"/>
</document>
</jsl:template>
<jsl:template match="head" trim="false">
<!-- Ignore, we've already done that -->
</jsl:template>
<jsl:template match="body" trim="false">
<body>
<!-- Index of releases -->
<section name="Release History">
<table>
<tr><th style='width:50px'>Version</th><th>Date</th><th>Description</th></tr>
<x:forEach select="release">
<tr>
<j:set var="version"><x:expr select="@version"/></j:set>
<j:set var="date"><x:expr select="@date"/></j:set>
<j:set var="description"><x:expr select="@description"/></j:set>
<j:set var="anchorName"><doc:escapeNameToken value="${version}"/></j:set>
<td><a href="#Release${anchorName}">${version}</a></td>
<td>${date}</td>
<td>${description}</td>
</tr>
</x:forEach>
</table>
<p>Get the RSS feed of the last changes <a href="changes.rss"><img src="images/rss.png"/></a></p>
</section>
<!-- Release information -->
<jsl:applyTemplates select="*"/>
</body>
</jsl:template>
<jsl:template match="release">
<j:set var="sectionName">Release <x:expr select="@version"/> - <x:expr select="@date"/></j:set>
<j:set var="version"><x:expr select="@version"/></j:set>
<section name="${sectionName}">
<j:set var="anchorName"><doc:escapeNameToken value="${version}"/></j:set>
<a id="Release${anchorName}" name="Release${anchorName}"/>
<table>
<tr><th style='width:50px'>Type</th><th>Changes</th><th style='width:70px'>By</th></tr>
<j:choose>
<j:when test="${maven.changes.sort}">
<u:tokenize var="actionTypes" delim=", ">${maven.changes.sort.order}</u:tokenize>
<!-- FIXME: Big hack here. Jelly looses the reference to the
current node so we have to explicitely remember it for
Jelly! -->
<x:set var="current" select="."/>
<j:forEach var="actionType" items="${actionTypes}">
<!-- FIXME: Find a way to pass the actionType value directly in the select
clause. This would remove the need for this ugly choose tag -->
<j:choose>
<j:when test="${actionType.equals('add')}">
<jsl:applyTemplates select="$current/action[@type='add']"/>
</j:when>
<j:when test="${actionType.equals('fix')}">
<jsl:applyTemplates select="$current/action[@type='fix']"/>
</j:when>
<j:when test="${actionType.equals('update')}">
<jsl:applyTemplates select="$current/action[@type='update']"/>
</j:when>
<j:when test="${actionType.equals('remove')}">
<jsl:applyTemplates select="$current/action[@type='remove']"/>
</j:when>
<j:otherwise>
<ant:fail>Invalid type '${actionType}'</ant:fail>
</j:otherwise>
</j:choose>
</j:forEach>
</j:when>
<j:otherwise>
<jsl:applyTemplates select="*"/>
</j:otherwise>
</j:choose>
</table>
</section>
</jsl:template>
<jsl:template match="action">
<j:set var="type"><x:expr select="@type"/></j:set>
<j:set var="dev"><x:expr select="@dev"/></j:set>
<j:set var="issue"><x:expr select="@issue"/></j:set>
<j:set var="dueto"><x:expr select="@due-to"/></j:set>
<j:set var="duetoemail"><x:expr select="@due-to-email"/></j:set>
<!-- FIXME: Same hack as above -->
<x:set var="currentAction" select="."/>
<tr>
<td><img src="images/${type}.gif" alt="${type}" title="${type}"/></td>
<td>
<x:if select="$currentAction/description">
<jsl:applyTemplates select="description"/>
</x:if>
<x:if select="not($currentAction/description)">
<jsl:applyTemplates trim="false"/>
</x:if>
<j:useBean var="finder" class="org.apache.maven.changes.IssueFinder"/>
<j:set var="template" value="${maven.changes.issue.template}"/>
<j:set var="trackerURL" value="${pom.issueTrackingUrl}"/>
<x:if select="$currentAction/fixes">
<j:set var="fixesTotal"><x:expr select="count(./fixes)"/></j:set>
<j:set var="fixesCount" value="1"/>
Fixes
<x:forEach var="item" select="./fixes">
<j:set var="issue"><x:expr select="@issue"/></j:set>
<a href="${finder.getIssueURL(trackerURL,issue,template)}">${issue}</a>
<j:choose>
<j:when test="${fixesCount == fixesTotal}">.</j:when>
<j:when test="${fixesCount == fixesTotal-1}"> and </j:when>
<j:otherwise>,</j:otherwise>
</j:choose>
<j:set var="fixesCount" value="${1+fixesCount}"/>
</x:forEach>
</x:if>
<x:if select="not($currentAction/fixes)">
<j:if test="${!empty(issue)}">
Fixes <a href="${finder.getIssueURL(trackerURL,issue,template)}">${issue}</a>.
</j:if>
</x:if>
<x:if select="$currentAction/dueto">
<j:set var="duetoTotal"><x:expr select="count(./dueto)"/></j:set>
<j:set var="duetoCount" value="1"/>
Thanks to
<x:forEach var="item" select="./dueto">
<j:set var="name"><x:expr select="@name"/></j:set>
<j:set var="email"><x:expr select="@email"/></j:set>
<j:if test="${!empty(email)}">
<a href="mailto:${email}">${name}</a>
</j:if>
<j:if test="${empty(email)}">
${name}
</j:if>
<j:choose>
<j:when test="${duetoCount == duetoTotal}">.</j:when>
<j:when test="${duetoCount == duetoTotal-1}"> and </j:when>
<j:otherwise>,</j:otherwise>
</j:choose>
<j:set var="duetoCount" value="${1+duetoCount}"/>
</x:forEach>
</x:if>
<x:if select="not($currentAction/dueto)">
<j:if test="${!empty(dueto)}">
<j:choose>
<j:when test="${duetoemail != ''}">
Thanks to <a href="mailto:${duetoemail}">${dueto}</a>.
</j:when>
<j:otherwise>
Thanks to ${dueto}.
</j:otherwise>
</j:choose>
</j:if>
</x:if>
</td>
<td><a href="team-list.html#${dev}">${dev}</a></td>
</tr>
</jsl:template>
<jsl:template match="description">
<jsl:applyTemplates trim="false"/>
</jsl:template>
<jsl:template match="*">
<jsl:copy trim="false">
<jsl:applyTemplates trim="false"/>
</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>