jfclere     2004/05/26 10:42:52

  Modified:    jk       build.xml
               jk/xdocs style.xsl.in
  Log:
  Add printer friendly pages.
  
  Revision  Changes    Path
  1.73      +64 -5     jakarta-tomcat-connectors/jk/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/build.xml,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- build.xml 14 Apr 2004 19:34:40 -0000      1.72
  +++ build.xml 26 May 2004 17:42:52 -0000      1.73
  @@ -436,13 +436,17 @@
     <!--
       Generate documentation from the XML sources.
     -->
  +  <target name="docs"
  +          depends="jkdocs,jkprinter,jk2printer" />
     <target
  -      name="docs" unless="docs-uptodate"
  +      name="jkdocs" unless="docs-uptodate"
         depends="docs.check,docs.init"
         description="Create Documentation">
    
       <!-- Create the directory where we're going to store the docs -->
       <mkdir dir="${build.docs}"/>
  +    <mkdir dir="${build.docs}/printer"/>
  +    <mkdir dir="${build.docs}/common/printer"/>
    
       <!-- Add some style to our otherwise  utterly ugly XML files -->
       <style
  @@ -451,7 +455,7 @@
           style="${source.docs}/style.xsl" >
           
           <include name="*/**.xml" />
  -        <exclude name="index.xml" />
  +        <exclude name="*.xml" />
           <exclude name="jk/**"  if="nojkdoc"/>
           <exclude name="jk2/**" if="nojk2doc"/>
           <param name="styles" expression="../"/>
  @@ -461,12 +465,33 @@
           basedir="${source.docs}"
           destdir="${build.docs}"
           style="${source.docs}/style.xsl" >
  -        <include name="index.xml" />
  -        <include name="faq.xml" />
  +        <include name="**.xml" />
           <param name="images" expression="images"/>
           <param name="styles" expression="."/>
           <param name="homedoc" expression=""/>
       </style>
  +
  +    <!-- Create the printer friendly pages -->
  +    <style
  +        basedir="${source.docs}"
  +        destdir="${build.docs}/printer"
  +        style="${source.docs}/style.xsl" >
  +        
  +        <include name="**.xml" />
  +        <param name="images" expression="images"/>
  +        <param name="styles" expression="."/>
  +        <param name="homedoc" expression=""/>
  +        <param name="project-menu" expression="nomenu"/>
  +    </style>
  +    <style
  +        basedir="${source.docs}/common"
  +        destdir="${build.docs}/common/printer"
  +        style="${source.docs}/style.xsl" >
  +        
  +        <include name="**.xml" />
  +        <param name="styles" expression="../"/>
  +        <param name="project-menu" expression="nomenu"/>
  +    </style>
    
       <!-- Copy all relevant (non processed) files from the sources -->
       <copy
  @@ -485,7 +510,41 @@
         </fileset>
       </copy>
   
  -  </target>                                                                     
  +  </target>
   
  +  <!-- build the printer friendly pages for jk -->
  +  <target
  +      name="jkprinter"
  +      unless="docs-uptodate"
  +      depends="docs.check,docs.init"
  +      description="Create Printer Friendly Documentation for jk">
  +        <mkdir dir="${build.docs}/jk/printer"/> 
  +        <style
  +            basedir="${source.docs}/jk"
  +            destdir="${build.docs}/jk/printer"
  +            style="${source.docs}/style.xsl" >
  +        
  +            <include name="**.xml" />
  +            <param name="styles" expression="../"/>
  +            <param name="project-menu" expression="nomenu"/>
  +        </style>
  +  </target>
  +  <!-- build the printer friendly pages for jk2 -->
  +  <target
  +      name="jk2printer"
  +      unless="docs-uptodate"
  +      depends="docs.check,docs.init"
  +      description="Create Printer Friendly Documentation for jk">
  +        <mkdir dir="${build.docs}/jk2/printer"/> 
  +        <style
  +            basedir="${source.docs}/jk2"
  +            destdir="${build.docs}/jk2/printer"
  +            style="${source.docs}/style.xsl" >
  +        
  +            <include name="**.xml" />
  +            <param name="styles" expression="../"/>
  +            <param name="project-menu" expression="nomenu"/>
  +        </style>
  +  </target>
   
   </project>
  
  
  
  1.18      +119 -0    jakarta-tomcat-connectors/jk/xdocs/style.xsl.in
  
  Index: style.xsl.in
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/xdocs/style.xsl.in,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- style.xsl.in      4 Mar 2004 04:46:33 -0000       1.17
  +++ style.xsl.in      26 May 2004 17:42:52 -0000      1.18
  @@ -30,6 +30,9 @@
     <xsl:param name="styles" select="''"/>
     <xsl:param name="images" select="'../images'"/>
     <xsl:param name="homedoc" select="'../'"/>
  +  <xsl:param name="project-menu"     select="'menu'"/>
  +  <xsl:param name="relative-path"    select="'.'"/>
  +  <xsl:param name="printer-location" select="'printer/'"/>
   
     <!-- Defined variables (non-overrideable) -->
     <xsl:variable name="body-bg"       select="'@body-bg@'"/>
  @@ -148,6 +151,8 @@
               Sidebar menu in a nested table and main content.
             -->
             <tr>
  +            <xsl:choose>
  +            <xsl:when test="$project-menu = 'menu'">
               <td bgcolor="#ffffff" width="150" valign="top">
   
                 <!--
  @@ -246,11 +251,37 @@
   
                 </table>
               </td>
  +            </xsl:when>
  +            </xsl:choose>
   
               <!--
                 Done with the sidebar, now, do we want some content as well or WHAT?
               -->
               <td bgcolor="#ffffff" width="*" valign="top" class="body">
  +              <!--
  +              Add printer friendly link.
  +              -->
  +              <table border="0" width="100%" cellspacing="4">
  +                <tr>
  +                  <td align="left" valign="top" nowrap="true">
  +                    <!-- Not yet available in jk docs
  +                    <h1><xsl:value-of select="project/title"/></h1>
  +                    -->
  +                    <h2><xsl:value-of select="properties/title"/></h2>
  +                  </td>
  +                  <td align="right" valign="top" nowrap="true">
  +                    <!-- Add the printer friendly link for docs with a menu -->
  +                    <xsl:if test="$project-menu = 'menu'">
  +                      <xsl:call-template name="addprint">
  +                      </xsl:call-template>
  +                    </xsl:if>
  +                    <xsl:if test="$project-menu != 'menu'">
  +                      <img src="{$images}/void.gif" width="1" height="1" vspace="0" 
hspace="0" border="0"/>
  +                    </xsl:if>
  +                  </td>
  +                </tr>
  +              </table>
  +
                 <xsl:apply-templates select="section"/>
               </td>
             </tr>
  @@ -735,6 +766,94 @@
         </xsl:otherwise>
       </xsl:choose>
     </xsl:template>
  +
  +  <!--
  +    Build the name of the location of the printer friendly page
  +  -->
  +  <xsl:template name="printeruri">
  +    <xsl:param name="attr" select="'href'"/>
  +    <xsl:param name="href" select="''"/>
  +
  +    <!-- Extract the filename -->
  +    <xsl:variable name="file">
  +      <xsl:choose>
  +        <xsl:when test="contains($href,'/')">
  +          <xsl:value-of select="substring-after($href,'/')" />
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$href" />
  +        </xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
  +    <xsl:variable name="filename">
  +      <xsl:choose>
  +        <xsl:when test="substring($file,string-length($file)-3) = '.xml'">
  +          <xsl:value-of select="substring($file,1,string-length($file)-3)"/>
  +          <xsl:value-of select="'html'"/>
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$file"/>
  +        </xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
  +
  +    <!-- Extract the directory name -->
  +    <xsl:variable name="dirname">
  +      <xsl:choose>
  +        <xsl:when test="contains($href,'/')">
  +          <xsl:value-of select="substring-before($href,'/')" />
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="''" />
  +        </xsl:otherwise>
  +      </xsl:choose>
  +    </xsl:variable>
  +    <!-- Build the target name -->
  +    <xsl:variable name="target">
  +      <xsl:value-of select="$homedoc"/>
  +      <xsl:choose>
  +        <xsl:when test="string-length($dirname) = 0">
  +          <xsl:value-of select="$printer-location"/>
  +        </xsl:when>
  +        <xsl:otherwise>
  +          <xsl:value-of select="$dirname"/>
  +          <xsl:value-of select="'/'"/>
  +          <xsl:value-of select="$printer-location"/>
  +        </xsl:otherwise>
  +      </xsl:choose>
  +      <xsl:value-of select="$filename"/>
  +    </xsl:variable>
  +
  +    <xsl:attribute name="{$attr}">
  +      <xsl:value-of select="$target"/>
  +    </xsl:attribute>
  +  </xsl:template>
  +
  +  <!--
  +    Get the file (via the menu.idx) and build the printer friendly link
  +  -->
  +  <xsl:template name="addprint">
  +    <xsl:variable name="root" select="/"/> 
  +    <xsl:for-each select="document('menu.idx')/index/section">
  +      <xsl:for-each select="./document">
  +        <xsl:variable name="href" select="@href"/>
  +        <xsl:if test="$root/document/properties/title = 
document(@href)/document/properties/title">
  +
  +          <small>
  +            <a>
  +              <xsl:call-template name="printeruri">
  +                <xsl:with-param name="href" select="$href"/>
  +              </xsl:call-template>
  +              <img src="{$images}/printer.gif" border="0" alt="Printer Friendly 
Version"/>
  +              <br />print-friendly<br />version
  +            </a>
  +          </small>
  +
  +        </xsl:if>
  +      </xsl:for-each>
  +    </xsl:for-each>
  +  </xsl:template>
  +
     <xsl:template match="copyright">
       <xsl:comment>
         <xsl:apply-templates select="text()" />
  
  
  

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

Reply via email to