You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2002/12/08 15:32:34 UTC

cvs commit: jakarta-turbine-maven/src/plugins-build/xdoc plugin.jelly site.dvsl site.jelly

dion        2002/12/08 06:32:34

  Modified:    src/plugins-build/xdoc plugin.jelly site.dvsl
  Removed:     src/plugins-build/xdoc site.jelly
  Log:
  - Patch to handle protocols other than http as submitted by Michael J. Brown
  - Got rid of site.jelly and moved it into plugin.jelly, as the import was driving me psycho
  - Reminder to self: j:import and j:include need a fileName option.
  
  Revision  Changes    Path
  1.27      +120 -6    jakarta-turbine-maven/src/plugins-build/xdoc/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/xdoc/plugin.jelly,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- plugin.jelly	5 Dec 2002 15:41:25 -0000	1.26
  +++ plugin.jelly	8 Dec 2002 14:32:33 -0000	1.27
  @@ -1,11 +1,15 @@
   <?xml version="1.0"?>
   
  -<project xmlns:j="jelly:core" 
  +<project xmlns:define="jelly:define"
  +         xmlns:dvsl="dvsl"
  +         xmlns:j="jelly:core" 
  +         xmlns:jsl="jelly:jsl"
            xmlns:log="jelly:log"
  -         xmlns:define="jelly:define"
  -         xmlns:texen="texen"
            xmlns:pom="pom"
  -         xmlns:dvsl="dvsl">
  +         xmlns:texen="texen"
  +         xmlns:util="jelly:util"
  +         xmlns:x="jelly:xml"
  +         xmlns:jslXdoc="jslXdoc">
   
     <!-- ================================================================== -->
     <!-- P R O J E C T  D O C U M E N T A T I O N                           -->
  @@ -316,7 +320,117 @@
   
     </goal>
   
  -  <!-- Import jelly site generation -->
  -  <j:import inherit="true" uri="file://${plugin.dir}/site.jelly" />
  +  <!-- ================================================================== -->
  +  <!-- J E L L Y   D O C U M E N T A T I O N                              -->
  +  <!-- ================================================================== -->
  +  <goal name="xdoc:jelly-init" description="Set up jelly xdoc requirements">
  +    <!-- moving here temporarily -->
  +    <tstamp>
  +      <format property="mavenCurrentYear" pattern="yyyy" />
  +    </tstamp>
  +    <tstamp>
  +      <format property="build.date" pattern="${maven.xdoc.date.format}"
  +              locale="${maven.xdoc.date.locale}"/>
  +    </tstamp>
  +    
  +    <!-- taglibs -->
  +    <define:taglib uri="jslXdoc">
  +      <define:tag name="itemLink">
  +        <j:set var="leaveLinkAlone" value="${(link.indexOf(':') >= 0) or link.startsWith('/site')}" />
  +        <j:if test="${leaveLinkAlone}">
  +          <a href="${link}">${name}</a>
  +        </j:if>
  +        <j:if test="${!leaveLinkAlone}">
  +          <a href="${relativePath}${link}">${name}</a>
  +        </j:if>
  +      </define:tag>
  +      
  +      <!-- Alternator for row style in a table -->
  +      <define:tag name="printRow">
  +        <j:if test="${(count % 2) gt 0}">
  +          <x:element name="tr">
  +            <x:attribute name="class">a</x:attribute>
  +          </x:element>
  +        </j:if>
  +        <j:if test="${(count % 2) le 0}">
  +          <x:element name="tr">
  +            <x:attribute name="class">b</x:attribute>
  +          </x:element>
  +        </j:if>
  +      </define:tag>
  +
  +    </define:taglib>
  +  </goal>
  +         
  +  <goal name="xdoc:jelly-transform" prereqs="xdoc:jelly-init"
  +    description="transform xdocs using jelly/jsl rather than dvsl">
  +
  +    <j:set var="destdir" value="${maven.docs.dest}" />
  +    <j:set var="outputencoding" value="${maven.docs.outputencoding}" />
  +
  +    <!-- need to parse navigation into $nav -->
  +  
  +    <fileScanner var="docFiles">
  +      <fileset dir="${maven.docs.src}">
  +        <patternset>
  +          <exclude name="**/project.xml" />
  +          <exclude name="**/template.xml" />
  +          <exclude name="**/navigation.xml" />
  +          <include name="**/*.xml"/>
  +        </patternset>
  +      </fileset>
  +    </fileScanner>
  +
  +    <!-- all this replace'ing is for the mapper's benefit - it treats 
  +    / and \ as different chars -->  
  +    <util:replace var="fromPattern" oldChar="\" newChar="/" value="${maven.docs.src}/*.xml"/>
  +    <util:replace var="toPattern" oldChar="\" newChar="/" value="${maven.docs.dest}/*.html"/>
  +
  +    <!-- mapper for determining output file name -->
  +    <j:new var="mapper" className="org.apache.tools.ant.util.GlobPatternMapper" />
  +    <j:setProperties object="${mapper}" from="${fromPattern}" to="${toPattern}" />
  +
  +    <!-- path tool for relative processing -->
  +    <j:new var="pathTool" className="org.apache.maven.DVSLPathTool" />
  +
  +
  +    <j:forEach var="file" items="${docFiles.iterator()}">
  +      <!-- generate output file name -->
  +      <util:replace var="outFileForward" oldChar="\" newChar="/" value="${file.toString()}"/>
  +      <j:set var="outFiles" value="${mapper.mapFileName(outFileForward)}" />
  +      <j:set var="outFile" value="${outFiles[0]}" />
  +
  +      <echo>Generating ${outFile} from ${file}</echo>
  +      <!-- work out relative path -->
  +      <util:replace var="docsForward" oldChar="\" newChar="/" value="${maven.docs.src}"/>
  +      <j:set var="relativePath" value="${pathTool.getRelativePath(docsForward, outFileForward)}"/>
  +
  +      <!-- determine nav file to be used -->
  +      <util:available file="${maven.docs.src}/stylesheets/project.xml">
  +        <j:set var="navFile" value="${maven.docs.src}/stylesheets/project.xml" />
  +      </util:available>
  +      <util:available file="${maven.docs.src}/project.xml">
  +        <j:set var="navFile" value="${maven.docs.src}/project.xml" />
  +      </util:available>
  +      <util:available file="${maven.docs.src}/navigation.xml">
  +        <j:set var="navFile" value="${maven.docs.src}/navigation.xml" />
  +      </util:available>
  +      <util:available file="${file.parentFile.absoluteFile}/navigation.xml">
  +        <j:set var="navFile" value="${file.parentFile.absoluteFile}/navigation.xml" />
  +      </util:available>
  +
  +      <!-- parse nav and make it available to the stylesheet -->
  +      <x:parse var="navXML" xml="${navFile}" />
  +      <x:set var="nav" select="$navXML/project" />
  +      <!-- parse the doc and pass it to the stylesheet -->      
  +      <x:parse var="doc" xml="${file.toURL()}" />
  +      <j:file name="${outFile}" prettyPrint="true">
  +        <j:include uri="./site.jsl" />
  +      </j:file>        
  +
  +    </j:forEach>
  +  
  +  </goal>
  + 
   
   </project>
  
  
  
  1.31      +1 -1      jakarta-turbine-maven/src/plugins-build/xdoc/site.dvsl
  
  Index: site.dvsl
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/xdoc/site.dvsl,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- site.dvsl	7 Dec 2002 20:38:32 -0000	1.30
  +++ site.dvsl	8 Dec 2002 14:32:33 -0000	1.31
  @@ -112,7 +112,7 @@
                   #end
   
                   <a href="$home">
  -                #if( $src.toString().startsWith("http") )
  +                #if( $src.toString().indexOf(":") != -1)
                     <img src="$src" align="left" alt="$alt" border="0" />
                   #else
                     <img src="$relativePath$src" align="left" alt="$alt" border="0" />