PR: MPXDOC-183

Submitted by: Niall Pemberton
Enable user-defined custom templates


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@370683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-01-20 00:37:34 +00:00
parent ab73751157
commit 954bd531d4
4 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
/* /*
* Copyright 2001-2004 The Apache Software Foundation. * Copyright 2001-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -694,25 +694,29 @@
value="${maven.docs.outputencoding}" value="${maven.docs.outputencoding}"
/> />
</j:if> </j:if>
<j:forEach var="pomDocument" items="${pomDocuments}"> <j:forEach var="pomDocument" items="${pomDocuments}">
<j:set var="templateBaseDir" value="${plugin.resources}/templates"/>
<util:available file="${maven.xdoc.custom.templateDir}/${pomDocument}">
<j:set var="templateBaseDir" value="${maven.xdoc.custom.templateDir}"/>
</util:available>
<!-- If the template ends with ".xml" use velocity to generate the <!-- If the template ends with ".xml" use velocity to generate the
HTML. If it ends with ".jelly" use JSL. --> HTML. If it ends with ".jelly" use JSL. -->
<j:choose> <j:choose>
<j:when test="${pomDocument.endsWith('.xml')}"> <j:when test="${pomDocument.endsWith('.xml')}">
<velocity:merge <velocity:merge
name="${maven.gen.docs}/${pomDocument}" name="${maven.gen.docs}/${pomDocument}"
basedir="${plugin.resources}/templates" basedir="${templateBaseDir}"
template="${pomDocument}" template="${pomDocument}"
inputEncoding="${encoding}" inputEncoding="${encoding}"
outputEncoding="${encoding}" outputEncoding="${encoding}"
/> />
</j:when> </j:when>
<j:when test="${pomDocument.endsWith('.jelly')}"> <j:when test="${pomDocument.endsWith('.jelly')}">
<doc:jslFile <doc:jslFile
output="${maven.gen.docs}/${pomDocument.substring(0,pomDocument.indexOf('.jelly'))}.xml" output="${maven.gen.docs}/${pomDocument.substring(0,pomDocument.indexOf('.jelly'))}.xml"
stylesheet="${plugin.resources}/templates/${pomDocument}" stylesheet="${templateBaseDir}/${pomDocument}"
outputMode="xml" outputMode="xml"
prettyPrint="no"/> prettyPrint="no"/>
</j:when> </j:when>

View File

@ -72,6 +72,10 @@ maven.xdoc.projectInfo = cvs-usage.xml,\
team-list.xml,\ team-list.xml,\
downloads.jelly downloads.jelly
# Custom user template directory,
# if not defined, ${plugin.resources}/templates is used by plugin.jelly
#maven.xdoc.custom.templateDir=
# List of xml files (or patterns) that are copied but not transformed # List of xml files (or patterns) that are copied but not transformed
#maven.xdoc.xml.copy= #maven.xdoc.xml.copy=

View File

@ -27,6 +27,7 @@
</properties> </properties>
<body> <body>
<release version="1.10-SNAPSHOT" date="in SVN"> <release version="1.10-SNAPSHOT" date="in SVN">
<action dev="ltheussl" type="add" issue="MPXDOC-183" due-to="Niall Pemberton">Enable user-defined custom templates.</action>
<action dev="ltheussl" type="fix" issue="MPXDOC-187">Correct cvs checkout instructions on cvs-usage page.</action> <action dev="ltheussl" type="fix" issue="MPXDOC-187">Correct cvs checkout instructions on cvs-usage page.</action>
<action dev="ltheussl" type="fix" issue="MPXDOC-125" due-to="Shinobu Kawai Yoshida">Url and timezone not used for contributor.</action> <action dev="ltheussl" type="fix" issue="MPXDOC-125" due-to="Shinobu Kawai Yoshida">Url and timezone not used for contributor.</action>
<action dev="ltheussl" type="fix" issue="MPXDOC-186">Mailing list links break if the address starts with http.</action> <action dev="ltheussl" type="fix" issue="MPXDOC-186">Mailing list links break if the address starts with http.</action>

View File

@ -279,6 +279,19 @@
that can be used in addition to maven-base.css. that can be used in addition to maven-base.css.
</td> </td>
</tr> </tr>
<tr>
<td>maven.xdoc.custom.templateDir</td>
<td>Yes</td>
<td>
A directory where custom templates for Maven generated sites may
be defined. The template files should have the same names as
the ones used by the xdoc plugin (<code>mail-lists.xml</code>,
<code>issue-tracking.xml</code>, etc.). By default, the templates
in the <code>${plugin.resources}/templates</code> directory
of the xdoc plugin are used.
</td>
</tr>
<tr> <tr>
<td>maven.xdoc.crumb.separator</td> <td>maven.xdoc.crumb.separator</td>
<td>Yes</td> <td>Yes</td>