MPCHANGES-14: Added sorting of <code>&lt;action&gt;</code> elements. It is controlled by 2 properties. The <code>maven.changes.sort</code> property decides whether sorting is enabled or not and the <code>maven.changes.sort.order</code> one decides the sort order. Defaults to <code>add,fix,update,remove</code>.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116227 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
vmassol
2004-11-11 13:46:58 +00:00
parent 2bfbff3677
commit 24d79b2485
4 changed files with 74 additions and 2 deletions

View File

@@ -35,3 +35,9 @@ maven.changes.issue.template = %URL%/%ISSUE%
# For Sourceforge, use the "aid" parameter. For example:
# maven.changes.issue.template = http://sourceforge.net/support/tracker.php?aid=%ISSUE%
# Decide whether to sort the change actions by type or not
maven.changes.sort = false
# Decide the sort order for action types
maven.changes.sort.order = add,fix,update,remove

View File

@@ -26,6 +26,8 @@
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">
@@ -66,8 +68,43 @@
<j:set var="anchorName"><doc:escapeNameToken value="${version}"/></j:set>
<a name="${anchorName}"/>
<table>
<tr><th style='width:50px'>Type</th><th>Changes</th><th style='width:70px'>By</th></tr>
<jsl:applyTemplates select="*"/>
<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>

View File

@@ -25,6 +25,13 @@
</properties>
<body>
<release version="1.6-SNAPSHOT" date="in CVS">
<action dev="vmassol" type="fix" issue="MPCHANGES-14">
Added sorting of <code>&lt;action&gt;</code> elements. It is controlled
by 2 properties. The <code>maven.changes.sort</code> property decides
whether sorting is enabled or not and the
<code>maven.changes.sort.order</code> one decides the sort order.
Defaults to <code>add,fix,update,remove</code>.
</action>
</release>
<release version="1.5.1" date="2004-10-23">
<action dev="vmassol" type="fix" issue="MPCHANGES-20">Fixed typo in changes.xml example on plugin web site.</action>

View File

@@ -45,6 +45,28 @@
BugZilla: <code>%URL%/show_bug.cgi?id=%ISSUE%</code>
</td>
</tr>
<tr>
<td>maven.changes.sort</td>
<td>Yes</td>
<td>
Decides whether to enable sorting the <code>&lt;action&gt;</code>
elements or not.
</td>
<td>
false
</td>
</tr>
<tr>
<td>maven.changes.sort.order</td>
<td>Yes</td>
<td>
Decides sort ordering of <code>&lt;action&gt;</code> elements.
It is only used if sorting is enabled.
</td>
<td>
add,fix,update,remove
</td>
</tr>
</table>
</section>
</body>