Only process html files if the source directory exists

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114143 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion committed 2003-10-01 12:42:15 +00:00
1 parent 65a5e71248
commit 5af0968d85
2 files changed
+40 -34

No files matched your search

+37 -34
View File
@@ -19,6 +19,7 @@
<j:set var="srcdir" value="${maven.html2xdoc.dir}"/>
<j:if test="${empty(srcdir)}">
<!-- FIXME? Should be maven.docs.src -->
<j:set var="srcdir" value="${basedir}/xdocs"/>
</j:if>
@@ -29,53 +30,55 @@
<util:file var="srcdirFile" name="${srcdir}"/>
<j:set var="srcdir" value="${srcdirFile.getCanonicalPath()}"/>
<util:file var="destdirFile" name="${destdir}"/>
<j:set var="destdir" value="${destdirFile.getCanonicalPath()}"/>
<util:available file="${srcdir}">
<util:file var="destdirFile" name="${destdir}"/>
<j:set var="destdir" value="${destdirFile.getCanonicalPath()}"/>
<util:replace var="fromPattern" oldChar="\" newChar="/" value="${srcdir}/*.html"/>
<util:replace var="toPattern" oldChar="\" newChar="/" value="${destdir}/*.xml"/>
<j:setProperties object="${mapper}" from="${fromPattern}" to="${toPattern}"/>
<util:replace var="fromPattern" oldChar="\" newChar="/" value="${srcdir}/*.html"/>
<util:replace var="toPattern" oldChar="\" newChar="/" value="${destdir}/*.xml"/>
<j:setProperties object="${mapper}" from="${fromPattern}" to="${toPattern}"/>
<util:replace var="fromDirPattern" oldChar="\" newChar="/" value="${srcdir}*"/>
<util:replace var="toDirPattern" oldChar="\" newChar="/" value="${destdir}*"/>
<util:replace var="fromDirPattern" oldChar="\" newChar="/" value="${srcdir}*"/>
<util:replace var="toDirPattern" oldChar="\" newChar="/" value="${destdir}*"/>
<j:new var="dirMapper" className="org.apache.maven.util.CaseInsensitiveGlobPatternMapper"/>
<j:setProperties object="${dirMapper}" from="${fromDirPattern}" to="${toDirPattern}"/>
<j:new var="dirMapper" className="org.apache.maven.util.CaseInsensitiveGlobPatternMapper"/>
<j:setProperties object="${dirMapper}" from="${fromDirPattern}" to="${toDirPattern}"/>
<ant:fileScanner var="docFiles">
<ant:fileset dir="${srcdir}">
<ant:patternset>
<ant:include name="**/*.html"/>
</ant:patternset>
</ant:fileset>
</ant:fileScanner>
<ant:fileScanner var="docFiles">
<ant:fileset dir="${srcdir}">
<ant:patternset>
<ant:include name="**/*.html"/>
</ant:patternset>
</ant:fileset>
</ant:fileScanner>
<j:forEach var="file" items="${docFiles.iterator()}">
<j:forEach var="file" items="${docFiles.iterator()}">
<!-- tool for converting HTML into XDoc -->
<j:useBean class="org.apache.maven.html2xdoc.Html2XdocBean" var="htmlTool"/>
<!-- tool for converting HTML into XDoc -->
<j:useBean class="org.apache.maven.html2xdoc.Html2XdocBean" var="htmlTool"/>
<util:replace var="inDirForward" oldChar="\" newChar="/" value="${file.parent}"/>
<j:set var="outDir" value="${dirMapper.mapFileName(inDirForward).0}"/>
<ant:mkdir dir="${outDir}"/>
<util:replace var="inDirForward" oldChar="\" newChar="/" value="${file.parent}"/>
<j:set var="outDir" value="${dirMapper.mapFileName(inDirForward).0}"/>
<ant:mkdir dir="${outDir}"/>
<!-- generate output file name -->
<util:replace var="outFileForward" oldChar="\" newChar="/" value="${file.toString()}"/>
<j:set var="outFile" value="${mapper.mapFileName(outFileForward).0}"/>
<!-- generate output file name -->
<util:replace var="outFileForward" oldChar="\" newChar="/" value="${file.toString()}"/>
<j:set var="outFile" value="${mapper.mapFileName(outFileForward).0}"/>
<ant:echo>Generating ${outFile} from ${file}</ant:echo>
<ant:echo>Generating ${outFile} from ${file}</ant:echo>
<!-- parse the HTML doc and pass it to the stylesheet -->
<html:parse var="htmlDoc" html="${file}" element="lower" attribute="lower"/>
<!-- parse the HTML doc and pass it to the stylesheet -->
<html:parse var="htmlDoc" html="${file}" element="lower" attribute="lower"/>
<!-- now lets convert the document into XML -->
<j:set var="xmlDoc" value="${htmlTool.convert(htmlDoc)}"/>
<!-- now lets convert the document into XML -->
<j:set var="xmlDoc" value="${htmlTool.convert(htmlDoc)}"/>
<j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml">
<x:copyOf select="$xmlDoc"/>
</j:file>
</j:forEach>
<j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml">
<x:copyOf select="$xmlDoc"/>
</j:file>
</j:forEach>
</util:available>
</goal>
<preGoal name="xdoc:jelly-transform">
+3
View File
@@ -8,6 +8,9 @@
<body>
<release version="1.2" date="in CVS">
<action dev="dion" type="update">
Only try to find files if the source directory exists
</action>
<!-- JAMES PUT STUFF HERE -->
</release>