forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cross...@apache.org
Subject svn commit: rev 35562 - in forrest/trunk: . src/core/context src/core/context/skins/common/xslt/text
Date Mon, 02 Aug 2004 03:41:37 GMT
Author: crossley
Date: Sun Aug  1 20:00:35 2004
New Revision: 35562

Added:
   forrest/trunk/src/core/context/skins/common/xslt/text/
   forrest/trunk/src/core/context/skins/common/xslt/text/document2pod.xsl   (contents, props
changed)
Modified:
   forrest/trunk/src/core/context/sitemap.xmap
   forrest/trunk/status.xml
Log:
New output format for POD (the Perl community's Plain Old Documentation)        triggered
using the .pod filename extension.
Initial work, needs enhancement. See ToDo list.
Submitted by: Rick Tessner
http://marc.theaimsgroup.com/?l=forrest-dev&m=109140623712387


Modified: forrest/trunk/src/core/context/sitemap.xmap
==============================================================================
--- forrest/trunk/src/core/context/sitemap.xmap	(original)
+++ forrest/trunk/src/core/context/sitemap.xmap	Sun Aug  1 20:00:35 2004
@@ -140,6 +140,7 @@
         <doctype-public>-//W3C//DTD SVG 1.0//EN</doctype-public>
         <doctype-system>http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd</doctype-system>
       </map:serializer>
+      <map:serializer logger="sitemap.serializer.text" mime-type="text/plain" name="text"
src="org.apache.cocoon.serialization.TextSerializer"/>
       
      <!--
       <map:serializer mime-type="application/x-shockwave-flash" name="swf" src="org.apache.cocoon.serialization.SWFSerializer"/>
@@ -400,6 +401,35 @@
             <map:mount uri-prefix="" src="raw.xmap" check-reload="yes" />
           </map:when>
         </map:select>
+      </map:match>
+
+      <!-- Plain Old Documentation -->
+      <map:match type="regexp" pattern="^(.*?)([^/]*).pod$">
+        <map:aggregate element="site">
+          <map:part src="cocoon:/skinconf.xml"/>
+          <map:part src="cocoon:/{1}{2}.xml"/>
+        </map:aggregate>
+        <map:transform type="xinclude"/>
+        <map:transform type="linkrewriter" src="cocoon://{1}linkmap-{2}.pod"/>
+        <map:transform src="resources/stylesheets/declare-broken-site-links.xsl"/>
+        <map:select type="exists">
+          <map:when test="{project:skins-dir}{forrest:skin}/xslt/text/document2pod.xsl">
+            <map:transform src="{project:skins-dir}{forrest:skin}/xslt/pod/document2pod.xsl">
+              <map:parameter name="docname" value="{2}"/>
+            </map:transform>
+          </map:when>
+          <map:when test="{forrest:context}/skins/{forrest:skin}/xslt/text/document2pod.xsl">
+            <map:transform src="{forrest:context}/skins/{forrest:skin}/xslt/text/document2pod.xsl">
+              <map:parameter name="docname" value="{2}"/>
+            </map:transform>
+          </map:when>
+          <map:otherwise>
+            <map:transform src="{forrest:context}/skins/common/xslt/text/document2pod.xsl">
+              <map:parameter name="docname" value="{2}"/>
+            </map:transform>
+          </map:otherwise>
+        </map:select>
+        <map:serialize type="text"/>
       </map:match>
 
       <map:match pattern="*.html">

Added: forrest/trunk/src/core/context/skins/common/xslt/text/document2pod.xsl
==============================================================================
--- (empty file)
+++ forrest/trunk/src/core/context/skins/common/xslt/text/document2pod.xsl	Sun Aug  1 20:00:35
2004
@@ -0,0 +1,866 @@
+<?xml version="1.0"?>
+<!--
+  Copyright 2002-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:fo="http://www.w3.org/1999/XSL/Format"
+                version="1.0">
+
+  <xsl:param name="docname">docname parameter from sitemap</xsl:param>
+
+  <!-- <xsl:import href="../../../common/xslt/fo/document2fo.xsl"/> -->
+
+  <!-- The Group logo -->
+  <xsl:variable name="group-logo"
+                select="string(//skinconfig/group-logo)"/>
+
+  <!-- The Project Name -->
+  <xsl:variable name="project-name"
+                select="string(//skinconfig/project-name)"/>
+
+  <!-- The Project Name -->
+  <xsl:variable name="project-desc"
+                select="string(//skinconfig/project-description)"/>
+
+  <xsl:param name="numbersections" select="'true'"/>
+
+  <!-- Section depth at which we stop numbering and just indent -->
+  <xsl:param name="numbering-max-depth" select="'3'"/>
+  <xsl:param name="imagesdir" select="."/>
+  <xsl:param name="xmlbasedir"/>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="//document"/>
+  </xsl:template>
+
+  <xsl:template match="document">
+    <xsl:text>
+=head1 NAME
+
+</xsl:text>
+    <xsl:value-of select="$docname"/><xsl:text> - </xsl:text>
+    <xsl:if test="//document/header/title">
+      <xsl:value-of select="//document/header/title"/>
+    </xsl:if>
+    <xsl:call-template name="line-blank"/>
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="body">
+    <xsl:text>
+=head1 DESCRIPTION
+
+</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="p[@class='quote']">
+    <xsl:text>
+ </xsl:text><xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+  
+  <xsl:template match="source">
+    <xsl:call-template name="emit-verbatim">
+      <xsl:with-param name="text" select="."/>
+    </xsl:call-template>
+
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template name="emit-verbatim">
+    <xsl:param name="text"/>
+
+    <xsl:text> </xsl:text>
+    <xsl:choose>
+      <xsl:when test="contains( $text, '&#xa;')">
+        <xsl:value-of select="substring-before( $text, '&#xa;' )"/>
+        <xsl:call-template name="cr"/>
+        <xsl:call-template name="emit-verbatim">
+          <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+        <xsl:call-template name="cr"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="max-len">
+    <xsl:param name="maxlen">0</xsl:param>
+    <xsl:param name="text"/>
+
+    <xsl:variable name="pre-newline">
+      <xsl:choose>
+        <xsl:when test="contains( $text, '&#xa;' )">
+          <xsl:value-of select="substring-before( $text, '&#xa;' )"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$text"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:variable name="post-newline">
+      <xsl:value-of select="substring-after( $text, '&#xa;' )"/>
+    </xsl:variable>
+
+    <xsl:variable name="len">
+      <xsl:choose>
+        <xsl:when test="string-length( $pre-newline ) > $maxlen">
+          <xsl:value-of select="string-length( $pre-newline )"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$maxlen"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="$post-newline=''">
+        <xsl:value-of select="$len"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="max-len">
+          <xsl:with-param name="maxlen" select="$len"/>
+          <xsl:with-param name="text" select="$post-newline"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="abstract">
+    <xsl:text>
+
+=head1 ABSTRACT
+
+</xsl:text>
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="section">
+    <!-- The sections become the main body of the POD, starting under 
+         a =head1 DESCRIPTION.  Therefore, their begining =head number
+         is 2.
+    -->
+    <xsl:param name="level">2</xsl:param>
+    <xsl:text>
+
+=head</xsl:text>
+    <xsl:value-of select="$level"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="title"/>
+    <xsl:call-template name="line-blank"/>
+    <xsl:apply-templates>
+      <xsl:with-param name="level" select="number($level)+1"/>
+    </xsl:apply-templates>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="section/title"/>
+
+  <xsl:template match="subtitle"/>
+
+  <xsl:template match="authors"/>
+
+  <xsl:template match="p">
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="p" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="note">
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="note" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ol|ul">
+    <xsl:call-template name="line-blank"/>
+    <xsl:text>
+=over 4
+</xsl:text>
+    <xsl:call-template name="line-blank"/>
+    <xsl:apply-templates select="li"/>
+    <xsl:text>
+=back
+</xsl:text>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ol|ul" mode="in-table">
+    <xsl:apply-templates select="li" mode="in-table"/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ol/li">
+    <xsl:text>
+=item </xsl:text>
+    <xsl:value-of select="position()"/><xsl:text>.</xsl:text>
+    <xsl:call-template name="line-blank"/>
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ol/li" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ul/li">
+    <xsl:text>
+=item *
+</xsl:text>
+    <xsl:call-template name="line-blank"/>
+    <xsl:apply-templates/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="ul/li" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+    <xsl:call-template name="line-blank"/>
+  </xsl:template>
+
+  <xsl:template match="dl">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="dt">
+    <xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="dd">
+    <xsl:text> </xsl:text><xsl:apply-templates/>
+  </xsl:template>
+
+  <xsl:template match="strong">
+    <xsl:variable name="tmp">
+      <xsl:text>B&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt;</xsl:text>
+    </xsl:variable>
+    <xsl:value-of select="concat( normalize-space( $tmp ), ' ' )"/>
+  </xsl:template>
+
+  <xsl:template match="strong" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+  </xsl:template>
+
+  <xsl:template match="em">
+    <xsl:variable name="tmp">
+      <xsl:text>I&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt;</xsl:text>
+    </xsl:variable>
+    <xsl:value-of select="concat( normalize-space( $tmp ), ' ' )"/>
+  </xsl:template>
+
+  <xsl:template match="em" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+  </xsl:template>
+
+  <xsl:template match="code">
+    <xsl:variable name="tmp">
+      <xsl:text>F&lt;</xsl:text><xsl:apply-templates/><xsl:text>&gt;</xsl:text>
+    </xsl:variable>
+    <xsl:value-of select="concat( normalize-space( $tmp ), ' ' )"/>
+  </xsl:template>
+
+  <xsl:template match="code" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+  </xsl:template>
+
+  <xsl:template match="link|jump|fork">
+    <!-- rewrite the rewritten link to make it palatable for POD -->
+    <xsl:text>L&lt;</xsl:text>
+    <xsl:choose>
+      <xsl:when test="contains( @href, '.html' )">
+        <xsl:value-of select="substring-before( @href, '.html' )"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="@href"/>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:text>&gt; </xsl:text>
+  </xsl:template>
+
+  <xsl:template match="link|jump|fork" mode="in-table">
+    <xsl:choose>
+      <xsl:when test="contains( @href, '.html' )">
+        <xsl:value-of select="substring-before( @href, '.html' )"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="@href"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- ==================================================================== -->
+  <!--  Table Handling
+
+        The column widths are calculated automatically based on a maximum
+        width, "maxwidth" (default 74),  that the table can be .  This maxiumum
+        width is used only for the calculation of the column widths.  These
+        column widths cannot be less than the "mincolwidth" (default 10).
+
+        If the calculated column widths are less than the "mincolwidth", the
+        table is grown horizontally based on the "mincolwidth" and the max
+        number of columns.
+
+        An idententation paramenter, "indent" (default 4) is used since pod2man
+        does a default indentation of 4 for verbatim text.  This value is used
+        in the calculation of the column widths.
+  -->
+  <!-- ==================================================================== -->
+
+  <xsl:template match="table">
+    <xsl:param name="maxwidth">74</xsl:param>
+    <xsl:param name="indent">4</xsl:param>
+    <xsl:param name="mincolwidth">10</xsl:param>
+    <xsl:variable name="cols">
+      <xsl:value-of select="count(tr[1]/th|tr[1]/td)"/>
+    </xsl:variable>
+
+    <xsl:variable name="calc-colwidth">
+      <xsl:value-of select="floor(($maxwidth - $indent - $cols) div $cols) - 1"/>
+    </xsl:variable>
+
+    <xsl:variable name="colwidth">
+      <xsl:choose>
+        <xsl:when test="$mincolwidth > $calc-colwidth">
+          <xsl:value-of select="$mincolwidth"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$calc-colwidth"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:apply-templates select="tr" mode="in-table">
+      <xsl:with-param name="colwidth" select="$colwidth"/>
+      <xsl:with-param name="cols" select="$cols"/>
+    </xsl:apply-templates>
+
+  </xsl:template>
+
+  <xsl:template match="tr" mode="in-table">
+    <xsl:param name="colwidth"/>
+    <xsl:param name="cols"/>
+
+    <xsl:variable name="dashes">
+      <xsl:call-template name="line-dashed"/>
+    </xsl:variable>
+
+    <xsl:variable name="cell-border">
+      <xsl:value-of select="substring( $dashes, 1, $colwidth )"/>
+    </xsl:variable>
+    
+    <xsl:variable name="row-border">
+      <xsl:call-template name="make-row-border">
+        <xsl:with-param name="col">1</xsl:with-param>
+        <xsl:with-param name="colwidth" select="$colwidth"/>
+        <xsl:with-param name="maxcols" select="$cols"/>
+        <xsl:with-param name="cell-border" select="$cell-border"/>
+      </xsl:call-template>
+    </xsl:variable>
+
+    <xsl:value-of select="$row-border"/>
+    <xsl:call-template name="cr"/>
+
+    <!-- Can we handle a dynamic number of columns?  Not sure how to
+         do that, so just limit the number we can handle to some reasonable
+         maximum.  Currently, that maximum is 10 -->
+
+    <!-- For the current row, grab the content for each cell in this row.
+         The content will be fit by the "handle-cell-content" template.  -->
+
+    <xsl:variable name="col-1">
+      <xsl:if test="(th|td)[1]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[1]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-2">
+      <xsl:if test="(th|td)[2]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[2]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-3">
+      <xsl:if test="(th|td)[3]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[3]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-4">
+      <xsl:if test="(th|td)[4]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[4]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-5">
+      <xsl:if test="(th|td)[5]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[5]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-6">
+      <xsl:if test="(th|td)[6]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[6]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-7">
+      <xsl:if test="(th|td)[7]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[7]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-8">
+      <xsl:if test="(th|td)[8]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[8]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-9">
+      <xsl:if test="(th|td)[9]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[9]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+    <xsl:variable name="col-10">
+      <xsl:if test="(th|td)[10]">
+        <xsl:variable name="tmp">
+          <xsl:apply-templates select="(th|td)[10]" mode="in-table"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:if>
+    </xsl:variable>
+
+    <!--
+      Okay, so we've got the contents of the cells for a single row.
+      Let's pass this off to emit-table-row where we can extract
+      $colwidth from each column and emit until we're out of content
+    -->
+
+    <xsl:call-template name="emit-table-row">
+      <xsl:with-param name="maxcols" select="$cols"/>
+      <xsl:with-param name="colwidth" select="$colwidth"/>
+      <xsl:with-param name="col-1" select="$col-1"/>
+      <xsl:with-param name="col-2" select="$col-2"/>
+      <xsl:with-param name="col-3" select="$col-3"/>
+      <xsl:with-param name="col-4" select="$col-4"/>
+      <xsl:with-param name="col-5" select="$col-5"/>
+      <xsl:with-param name="col-6" select="$col-6"/>
+      <xsl:with-param name="col-7" select="$col-7"/>
+      <xsl:with-param name="col-8" select="$col-8"/>
+      <xsl:with-param name="col-9" select="$col-9"/>
+      <xsl:with-param name="col-10" select="$col-10"/>
+    </xsl:call-template>
+
+    <xsl:if test="position()=last()">
+      <xsl:value-of select="$row-border"/>
+      <xsl:call-template name="cr"/>
+    </xsl:if>
+
+  </xsl:template>
+
+  <xsl:template match="td|th" mode="in-table">
+    <xsl:apply-templates mode="in-table"/>
+  </xsl:template>
+
+  <!-- 120 dashes.  Used in building horizontal row borders -->
+  <xsl:template name="line-dashed">
+    <xsl:variable name="char-20">--------------------</xsl:variable>
+    <xsl:value-of select="concat($char-20, $char-20, $char-20, $char-20, $char-20, $char-20)"/>
+  </xsl:template>
+
+  <!-- 120 spaces Used in building columns in tables.-->
+  <xsl:template name="line-spaces">
+    <xsl:variable name="char-20"><xsl:text>                    </xsl:text></xsl:variable>
+    <xsl:value-of select="concat($char-20, $char-20, $char-20, $char-20, $char-20, $char-20)"/>
+  </xsl:template>
+
+  <xsl:template name="make-row-border">
+    <xsl:param name="col"/>
+    <xsl:param name="colwidth"/>
+    <xsl:param name="maxcols"/>
+    <xsl:param name="cell-border"/>
+    <xsl:param name="border">+</xsl:param>
+
+    <xsl:choose>
+      <xsl:when test="$col > $maxcols">
+        <!-- Space at beginning to tell POD to emit as is -->
+        <xsl:value-of select="concat( ' ', $border )"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:call-template name="make-row-border">
+          <xsl:with-param name="col" select="$col + 1"/>
+          <xsl:with-param name="maxcols" select="$maxcols"/>
+          <xsl:with-param name="cell-border" select="$cell-border"/>
+          <xsl:with-param name="border"
+              select="concat($border, $cell-border, '+')"/>
+        </xsl:call-template>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <!-- emit-table-row
+
+       Recursive template to keep extracting content from each of the
+       columns, emit a single line in each cell, until all the content
+       is used up
+  -->
+
+  <xsl:template name="emit-table-row">
+    <xsl:param name="maxcols"/>
+    <xsl:param name="colwidth"/>
+    <xsl:param name="col-1"/>
+    <xsl:param name="col-2"/>
+    <xsl:param name="col-3"/>
+    <xsl:param name="col-4"/>
+    <xsl:param name="col-5"/>
+    <xsl:param name="col-6"/>
+    <xsl:param name="col-7"/>
+    <xsl:param name="col-8"/>
+    <xsl:param name="col-9"/>
+    <xsl:param name="col-10"/>
+
+    <xsl:text> | </xsl:text>
+    <xsl:call-template name="make-cell">
+      <xsl:with-param name="content" select="$col-1"/>
+      <xsl:with-param name="colwidth" select="$colwidth"/>
+    </xsl:call-template>
+
+    <xsl:if test="$maxcols > 1">
+
+      <xsl:text> | </xsl:text>
+      <xsl:call-template name="make-cell">
+        <xsl:with-param name="content" select="$col-2"/>
+        <xsl:with-param name="colwidth" select="$colwidth"/>
+      </xsl:call-template>
+
+      <xsl:if test="$maxcols > 2">
+
+        <xsl:text> | </xsl:text>
+        <xsl:call-template name="make-cell">
+          <xsl:with-param name="content" select="$col-3"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+
+        <xsl:if test="$maxcols > 3">
+
+          <xsl:text> | </xsl:text>
+          <xsl:call-template name="make-cell">
+            <xsl:with-param name="content" select="$col-4"/>
+            <xsl:with-param name="colwidth" select="$colwidth"/>
+          </xsl:call-template>
+
+          <xsl:if test="$maxcols > 4">
+
+            <xsl:text> | </xsl:text>
+            <xsl:call-template name="make-cell">
+              <xsl:with-param name="content" select="$col-5"/>
+              <xsl:with-param name="colwidth" select="$colwidth"/>
+            </xsl:call-template>
+
+            <xsl:if test="$maxcols > 5">
+
+              <xsl:text> | </xsl:text>
+              <xsl:call-template name="make-cell">
+                <xsl:with-param name="content" select="$col-6"/>
+                <xsl:with-param name="colwidth" select="$colwidth"/>
+              </xsl:call-template>
+
+              <xsl:if test="$maxcols > 6">
+
+                <xsl:text> | </xsl:text>
+                <xsl:call-template name="make-cell">
+                  <xsl:with-param name="content" select="$col-7"/>
+                  <xsl:with-param name="colwidth" select="$colwidth"/>
+                </xsl:call-template>
+
+                <xsl:if test="$maxcols > 7">
+
+                  <xsl:text> | </xsl:text>
+                  <xsl:call-template name="make-cell">
+                    <xsl:with-param name="content" select="$col-8"/>
+                    <xsl:with-param name="colwidth" select="$colwidth"/>
+                  </xsl:call-template>
+
+                  <xsl:if test="$maxcols > 8">
+
+                    <xsl:text> | </xsl:text>
+                    <xsl:call-template name="make-cell">
+                      <xsl:with-param name="content" select="$col-9"/>
+                      <xsl:with-param name="colwidth" select="$colwidth"/>
+                    </xsl:call-template>
+
+                    <xsl:if test="$maxcols > 9">
+
+                      <xsl:text> | </xsl:text>
+                      <xsl:call-template name="make-cell">
+                        <xsl:with-param name="content" select="$col-10"/>
+                        <xsl:with-param name="colwidth" select="$colwidth"/>
+                      </xsl:call-template>
+
+                    </xsl:if>
+                  </xsl:if>
+                </xsl:if>
+              </xsl:if>
+            </xsl:if>
+          </xsl:if>
+        </xsl:if>
+      </xsl:if>
+    </xsl:if>
+
+    <xsl:text> |</xsl:text>
+    <xsl:call-template name="cr"/>
+
+    <!-- Determine whether there is any content left in any of the
+         cells on this row.  If so, we need to call emit-table-row again -->
+
+    <xsl:variable name="content-remains">
+      <xsl:if test="string-length(substring($col-1, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-2, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-3, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-4, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-5, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-6, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-7, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-8, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-9, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+      <xsl:if test="string-length(substring($col-10, $colwidth - 2)) > 1">
+        <xsl:text>1</xsl:text>
+      </xsl:if>
+    </xsl:variable>
+
+    <xsl:if test="string-length($content-remains) > 0">
+      <xsl:call-template name="emit-table-row">
+        <xsl:with-param name="maxcols" select="$maxcols"/>
+        <xsl:with-param name="colwidth" select="$colwidth"/>
+        <xsl:with-param name="col-1"
+            select="substring( $col-1, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-2" 
+            select="substring( $col-2, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-3"
+            select="substring( $col-3, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-4"
+            select="substring( $col-4, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-5"
+            select="substring( $col-5, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-6"
+            select="substring( $col-6, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-7" 
+            select="substring( $col-7, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-8"
+            select="substring( $col-8, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-9"
+            select="substring( $col-9, $colwidth - 2 + 1 )"/>
+        <xsl:with-param name="col-10"
+            select="substring( $col-10, $colwidth - 2 + 1 )"/>
+      </xsl:call-template>
+    </xsl:if>
+
+  </xsl:template>
+
+  <xsl:template name="make-cell">
+    <xsl:param name="content"/>
+    <xsl:param name="colwidth"/>
+
+    <xsl:variable name="padding">
+      <xsl:call-template name="line-spaces"/>
+    </xsl:variable>
+
+    <xsl:variable name="cell">
+      <xsl:choose>
+        <xsl:when test="$colwidth - 2 > string-length($content)">
+
+          <!-- The subtraction of 2 is for the border padding.  It is reflected
+               in the call to make-cell in the "content" parameter -->
+
+          <xsl:value-of select="concat($content,
+               substring($padding,1,$colwidth - 2 - string-length($content)))"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="substring($content, 1, $colwidth - 2)"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
+
+    <xsl:value-of select="$cell"/>
+  </xsl:template>
+
+  <!--  handle-cell-content
+
+        Replaces any new-line characters found in the content with 
+        an appropriate number of spaces to fill out the cell to the
+        end of the cell and another number of spaces to fill out a 
+        "blank" line.
+  -->
+
+  <xsl:template name="handle-cell-content">
+    <xsl:param name="text"/>
+    <xsl:param name="colwidth"/>
+
+    <xsl:variable name="spaces">
+      <xsl:call-template name="line-spaces"/>
+    </xsl:variable>
+
+    <xsl:choose>
+      <xsl:when test="contains( $text, '&#xa;' )">
+        <xsl:variable name="text-before">
+          <xsl:value-of select="substring-before( $text, '&#xa;' )"/>
+        </xsl:variable>
+        <xsl:variable name="tmp">
+          <xsl:value-of select="concat( $text-before,
+                substring( $spaces, 1, ($colwidth - 2) - (string-length( $text-before ) mod
($colwidth - 2) )),
+                substring-after( $text, '&#xa;' ))"/>
+        </xsl:variable>
+        <xsl:call-template name="handle-cell-content">
+          <xsl:with-param name="text" select="$tmp"/>
+          <xsl:with-param name="colwidth" select="$colwidth"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+
+  </xsl:template>
+<!-- ====================================================================== -->
+<!-- Local Extensions section -->
+<!-- ====================================================================== -->
+
+  <xsl:template match="version"/>
+
+  <xsl:template match="authors"/>
+
+  <xsl:template match="acronym">
+    <xsl:value-of select="."/><xsl:text> [</xsl:text><xsl:value-of select="@title"/><xsl:text>]
</xsl:text>
+
+  </xsl:template>
+
+  <xsl:template match="text()" mode="as-is">
+    <xsl:value-of select="."/>
+  </xsl:template>
+
+  <xsl:template match="text()">
+    <xsl:variable name="tmp">
+      <xsl:value-of select="normalize-space(.)"/>
+    </xsl:variable>
+
+    <xsl:if test="$tmp!=''">
+      <xsl:value-of select="$tmp"/>
+      <xsl:text> </xsl:text>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="text()" mode="in-table">
+    <xsl:value-of select="normalize-space(.)"/>
+  </xsl:template>
+
+  <xsl:template match="*"/>
+
+  <!-- Named templates -->
+
+  <!-- Simple carriage return -->
+  <xsl:template name="cr">
+    <xsl:text>
+</xsl:text>
+  </xsl:template>
+
+  <!-- Single blank line, no spaces, to separate POD elements -->
+  <xsl:template name="line-blank">
+    <xsl:call-template name="cr"/>
+    <xsl:call-template name="cr"/>
+  </xsl:template>
+
+
+</xsl:stylesheet>

Modified: forrest/trunk/status.xml
==============================================================================
--- forrest/trunk/status.xml	(original)
+++ forrest/trunk/status.xml	Sun Aug  1 20:00:35 2004
@@ -45,14 +45,23 @@
 
   <changes>
     <release version="0.6-dev" date="unreleased">
-      <action dev="RDG" type="add" context="code">
-        Eclipse plugin code added to scratchpad; donated by <link href="http://www.burrokeet.org/">Burrokeet</link>
-      </action>
       <action dev="DC" type="add" context="docs">
       <!-- Please keep this action at the top -->
         Added new document to facilitate
         <link href="site:upgrading_06">upgrading to v0.6</link>
       </action>
+      <action dev="DC" type="add" context="core" due-to="Rick Tessner">
+        New output format for POD (the Perl community's Plain Old Documentation)
+        triggered using the .pod filename extension.
+        Initial work, needs enhancement. See
+        <link
+          href="http://marc.theaimsgroup.com/?t=107512563400001">forrest-dev
+          discussion</link>
+      </action>
+      <action dev="RDG" type="add" context="code">
+        Eclipse plugin code added to scratchpad (donated by <link href="http://www.burrokeet.org/">Burrokeet</link>).
+        Initial work, needs enhancement.
+      </action>
       <action dev="DB" type="remove" context="skins" fixes-bug="FOR-181">
         Skins forrest-css, forrest-site and avalon-tigris deleted; krysalis-site
         renamed to book-tab and tigris-style renamed to tigris-style-1_1.  Aliases
@@ -1382,7 +1391,7 @@
         Fixed a bug where having a tabs.xml link to a file not otherwise mentioned
         in book.xml caused a broken link.  See
         <link
-          href="http://marc.theaimsgroup.com/?t=103607092100004&amp;r=1&amp;w=2">forrest-dev
+          href="http://marc.theaimsgroup.com/?t=103607092100004">forrest-dev
           discussion</link>
       </action>
       <action dev="JT" type="fix" context="docs">

Mime
View raw message