]> granicus.if.org Git - docbook-dsssl/commitdiff
Fix singly-nested lists.
authorTim Waugh <twaugh@redhat.com>
Thu, 11 Dec 2003 18:05:42 +0000 (18:05 +0000)
committerTim Waugh <twaugh@redhat.com>
Thu, 11 Dec 2003 18:05:42 +0000 (18:05 +0000)
xsl/manpages/lists.xsl

index ad4c8262f4c67fb59b4d6149df11e6975ed5b54e..215f67a4d6f5d3446d81dc9149c9172e4227a3d9 100644 (file)
@@ -4,13 +4,40 @@
                 version='1.0'>
 
 <xsl:template match="para|simpara|remark" mode="list">
-  <xsl:variable name="foo">
-    <xsl:apply-templates/>
-  </xsl:variable>
-  <xsl:value-of select="normalize-space($foo)"/>
+  <xsl:for-each select="node()">
+    <xsl:choose>
+      <xsl:when test="self::literallayout|self::screen|self::programlisting|self::itemizedlist|self::orderedlist|self::variablelist">
+        <xsl:text>&#10;</xsl:text>
+        <xsl:apply-templates select="." mode="list"/>
+      </xsl:when>
+      <xsl:when test="self::text()">
+       <xsl:if test="starts-with(translate(.,'&#10;',' '), ' ') and
+                     preceding-sibling::node()[name(.)!='']">
+         <xsl:text> </xsl:text>
+       </xsl:if>
+        <xsl:variable name="content">
+         <xsl:apply-templates select="."/>
+       </xsl:variable>
+       <xsl:value-of select="normalize-space($content)"/>
+       <xsl:if
+        test="translate(substring(., string-length(.), 1),'&#10;',' ') = ' '
+             and following-sibling::node()[name(.)!='']">
+         <xsl:text> </xsl:text>
+       </xsl:if>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:variable name="content">
+          <xsl:apply-templates select="."/>
+        </xsl:variable>
+        <xsl:value-of select="normalize-space($content)"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:for-each>
   <xsl:text>&#10;</xsl:text>
-  <xsl:if test="following-sibling::para or following-sibling::simpara or
-               following-sibling::remark">
+
+  <xsl:if test="following-sibling::para or
+         following-sibling::simpara or
+         following-sibling::remark">
     <!-- Make sure multiple paragraphs within a list item don't -->
     <!-- merge together.                                        -->
     <xsl:text>&#10;</xsl:text>
 
 <xsl:template match="itemizedlist/listitem">
   <xsl:text>\(bu&#10;</xsl:text>
-  <xsl:variable name="content">
-    <xsl:apply-templates mode="list"/>
-  </xsl:variable>
-  <xsl:value-of select="normalize-space($content)"/>
+  <xsl:apply-templates mode="list"/>
   <xsl:if test="position()!=last()">
     <xsl:text>.TP&#10;</xsl:text>
   </xsl:if>
   <xsl:text>.LP&#10;</xsl:text>
 </xsl:template>
 
+<xsl:template match="itemizedlist|orderedlist|procedure" mode="list">
+  <xsl:text>&#10;.RS&#10;.TP 3&#10;</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>.LP&#10;.RE&#10;</xsl:text>
+</xsl:template>
+
 </xsl:stylesheet>