dion        2002/11/20 16:20:41

  Modified:    src/plugins-build/xdoc site.jelly
  Log:
  *** keyword substitution change ***
  
  Revision  Changes    Path
  1.5       +119 -124  jakarta-turbine-maven/src/plugins-build/xdoc/site.jelly
  
  Index: site.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/xdoc/site.jelly,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- site.jelly        17 Nov 2002 03:23:57 -0000      1.4
  +++ site.jelly        21 Nov 2002 00:20:41 -0000      1.5
  @@ -1,125 +1,120 @@
  -<?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
  -
  --->
  -<m:project xmlns:b="jelly:beanshell"
  -         xmlns:j="jelly:core" 
  -         xmlns:jsl="jelly:jsl"
  -         xmlns:log="jelly:log"
  -         xmlns:m="jelly:jeez"
  -         xmlns:util="jelly:util"
  -         xmlns:x="jelly:xml"
  -         xmlns="dummy">
  -         
  -  <m: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 -->
  -  
  -    <m:fileScanner var="docFiles">
  -      <m:fileset dir="${maven.docs.src}">
  -        <m:patternset>
  -          <m:exclude name="**/project.xml" />
  -          <m:exclude name="**/template.xml" />
  -          <m:exclude name="**/navigation.xml" />
  -          <m:include name="**/*.xml"/>
  -        </m:patternset>
  -      </m:fileset>
  -    </m: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.gen.docs}/*.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()}">
  -      <!-- need 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]}" />
  -
  -      <m:echo>Generating ${outFile} from ${file}</m:echo>
  -      <util:replace var="docsForward" oldChar="\" newChar="/" 
value="${maven.docs.src}"/>
  -      <j:set var="relativePath" value="${pathTool.getRelativePath(docsForward, 
outFileForward)}"/>
  -
  -      <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>
  -      <m:echo>nav = ${navFile}, file=${file.toURL()}</m:echo>
  -
  -      <x:parse var="navXML" xml="${navFile}" />
  -      <x:set var="nav" select="$navXML/project" />
  -
  -      <!-- stick a j:file around this and make it a tag -->      
  -      <x:parse var="doc" xml="${file.toURL()}" />
  -      <x:expr select="$doc/document/properties/title" />
  -      <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>
  -              <j:set var="docTitle"><x:expr select="$doc/document/properties/title" 
/></j:set>
  -              <x:if select="$nav/title">
  -                <title><x:expr select="$nav/title" /> - ${docTitle}</title>
  -              </x:if>
  -              <x:if select="not($nav/title)">
  -                <title>${pom.name} - ${docTitle}</title>
  -              </x:if>
  -
  -              <style type="text/css">
  -                @import url("${relativePath}/style/tigris.css");
  -                @import url("${relativePath}/style/maven.css");
  -              </style>
  -              <script type="text/javascript">
  -                if (document.layers) {
  -                  document.writeln('<link rel="stylesheet" type="text/css" 
href="${relativePath}/style/ns4_only.css" media="screen" />'+
  -                  '<link rel="stylesheet" type="text/css" 
href="${relativePath}/style/maven_ns4_only.css" media="screen" />')
  -                }
  -              </script>
  -              <link rel="stylesheet" type="text/css" 
href="${relativePath}/style/print.css" media="print" />
  -              <x:forEach var="author" select="$doc/document/properties/author">
  -                <meta name="author" value="${author.text}"/>
  -                <meta name="email" value="${author.attribute('email').value}" />
  -              </x:forEach>
  -
  -            </head>
  -          </html>
  -        </jsl:template>
  -      </jsl:stylesheet>
  -    
  -    </j:forEach>
  -  
  - </m:goal>
  - 
  +<?xml version="1.0"?>
  +<!--                                                                -->
  +<!-- Jelly version of site.dvsl                                     -->
  +<!--                                                                -->
  +<m:project xmlns:define="jelly:define"
  +         xmlns:j="jelly:core" 
  +         xmlns:jsl="jelly:jsl"
  +         xmlns:log="jelly:log"
  +         xmlns:m="jelly:jeez"
  +         xmlns:util="jelly:util"
  +         xmlns:x="jelly:xml"
  +         xmlns:jslXdoc="jslXDoc"
  +         xmlns="dummy">
  +
  +  <m:goal name="xdoc:jelly-init" description="Set up jelly xdoc requirements">
  +    <!-- moving here temporarily -->
  +    <m:tstamp>
  +      <m:format property="mavenCurrentYear" pattern="yyyy" />
  +    </m:tstamp>
  +    <m:tstamp>
  +      <m:format property="build.date" pattern="${maven.xdoc.date.format}"
  +              locale="${maven.xdoc.date.locale}"/>
  +    </m:tstamp>
  +    
  +    <!-- taglibs -->
  +    <define:taglib uri="jslXdoc">
  +      <define:tag name="itemLink">
  +        <j:set var="leaveLinkAlone" value="${link.startsWith('http') 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}"
  +          <tr class="a"> 
  +        </j:if>
  +        <j:if test="${(count % 2) le 0}"
  +          <tr class="b">
  +        </j:if>
  +      </define:tag>
  +
  +    </define:taglib>
  +  </m:goal>
  +         
  +  <m: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 -->
  +  
  +    <m:fileScanner var="docFiles">
  +      <m:fileset dir="${maven.docs.src}">
  +        <m:patternset>
  +          <m:exclude name="**/project.xml" />
  +          <m:exclude name="**/template.xml" />
  +          <m:exclude name="**/navigation.xml" />
  +          <m:include name="**/*.xml"/>
  +        </m:patternset>
  +      </m:fileset>
  +    </m: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]}" />
  +
  +      <m:echo>Generating ${outFile} from ${file}</m: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" outputMode="html">
  +        <j:include uri="./site.jsl" />
  +      </j:file>        
  +
  +    </j:forEach>
  +  
  + </m:goal>
  + 
    </m:project>
  
  
  

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

Reply via email to