dion        2002/11/16 01:33:15

  Modified:    src/plugins-build/xdoc plugin.jelly
  Added:       src/plugins-build/xdoc site.jelly
  Log:
  Futzing about with jelly:jsl generation of docs.
  This is so others can see/comment before I keep going too far
  
  Revision  Changes    Path
  1.19      +3 -0      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- plugin.jelly      6 Nov 2002 16:27:35 -0000       1.18
  +++ plugin.jelly      16 Nov 2002 09:33:15 -0000      1.19
  @@ -286,4 +286,7 @@
   
     </goal>
   
  +  <!-- Import jelly site generation -->
  +  <j:import inherit="true" uri="site.jelly" />
  +
   </project>
  
  
  
  1.1                  jakarta-turbine-maven/src/plugins-build/xdoc/site.jelly
  
  Index: site.jelly
  ===================================================================
  <?xml version="1.0"?>
  <!--                                                                -->
  <!-- Jelly version of site.dvsl                                     -->
  <!--                                                                -->
  <!--
  ## Alternator for row style in a table
  ##
  #macro (printRow $count)
    #if ($count % 2 > 0)
      <tr class="a"> 
    #else
      <tr class="b">
    #end
  #end
  
  ## Sets the navigation file
  ##
  #macro (loadNavigation $filename)
    #set( $nav = $node.selectSingleNode("document('$filename')/project") )
  #end
  
  ## Selects the appropriate navigation file to use for the navbar.  The
  ## current search priority is: 
  ##    
  ##    - navigation.xml in current directory
  ##    - navigation.xml in xdocs directory 
  ##    - project.xml in xdocs directory (deprecated)
  ##    - project.xml in xdocs/stylesheets
  ##
  #macro (selectNavigation $fileUtil $docSrc)
  
    #if ($fileUtil.file("$docSrc/$currentDir/navigation.xml").exists())
      #loadNavigation ("$docSrc/$currentDir/navigation.xml")
  
    #elseif ($fileUtil.file("$docSrc/navigation.xml").exists())
      #loadNavigation ("$docSrc/navigation.xml")
    
    #elseif ($fileUtil.file("$docSrc/project.xml").exists())
      #loadNavigation ("$docSrc/project.xml")
  
    #elseif ($fileUtil.file("$docSrc/stylesheets/project.xml").exists())
      #loadNavigation ("$docSrc/stylesheets/project.xml")
    #end
  
  #end
  -->
  <project xmlns:b="jelly:beanshell"
           xmlns:j="jelly:core" 
           xmlns:jsl="jelly:jsl"
           xmlns:log="jelly:log"
           xmlns:util="jelly:util"
           xmlns:x="jelly:xml">
           
    <goal name="xdoc:jelly-transform">
      <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>
  
        <b:script>
        context.setVariable("fromPattern", 
          context.findVariable("maven.docs.src").toString().replace('C', 'D'));
      </b:script>
      <echo>fromPattern=${fromPattern}</echo>
      <mapper id="mapper" 
        className="org.apache.tools.ant.util.GlobPatternMapper"
        from="${maven.docs.src}/*.xml" to="${maven.docs.src}/*.html" />
  
      <j:forEach var="file" items="${docFiles.iterator()}">
        <!-- need generate output file name -->
        <j:set var="outFiles" 
value="${mapper.implementation.mapFileName(file.toString())}" />
        <j:set var="outFile" value="${outFiles[0]}" />
  
        <echo>Generating ${outFile} from ${file}</echo>
        <x:parse var="doc" xml="${file.toURL()}" />
  
        <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>
        <echo>nav = ${navFile}</echo>
        <!--<x:parse var="nav" xml="${navFile}" />-->
        <x:set var="nav" select="document($navFile)/project" />
        
        <jsl:stylesheet select="$doc">
          <jsl:template match="document" trim="no">
            <x:doctype name="html" 
              publicId="-//CollabNet//DTD XHTML 1.0 Transitional//EN"
              systemId="http://www.collabnet.com/dtds/collabnet_transitional_10.dtd"; 
/>
            <html>
              <head>
                <x:if select="$nav/title">
                  <title><x:expr select="$nav/title" /> - <x:expr 
select="./properties/title" /></title>
                </x:if>
                <x:if select="not($nav/title)">
                  <title>${pom.name} - <x:expr select="./properties/title"/></title>
                </x:if>
              </head>
            </html>
          </jsl:template>
        </jsl:stylesheet>
      
      </j:forEach>
    
   </goal>
   
   </project>
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to