]> granicus.if.org Git - docbook-dsssl/commitdiff
Changed handling of hanging indents for cmdsynopsis, funcsynopsis,
authorMichael Smith <xmldoc@users.sourceforge.net>
Thu, 27 Mar 2008 12:07:43 +0000 (12:07 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Thu, 27 Mar 2008 12:07:43 +0000 (12:07 +0000)
and synopfragment such that they now look correct in non-TTY/PS
output. We now use the groff \w escape to hang by the actual width
-- in the current font -- of the command, funcdef, or
synopfragment references number (as opposed to hanging by the
number of characters). This rendering in TTY output remains the
same, since the width in monospaced TTY output is the same as the
number of characters.

Also, created new synopsis-block-start and synopsis-block-end
templates to use for cmdsynopsis and funcsynopsis instead of the
corresponding verbatim-* templates.

Along with those changes, also corrected a problem that caused the
content of synopfragment to be dropped, and made a
vertical-spacing change to adjust spacing around table titles and
among sibling synopfragment instances.

xsl/manpages/synop.xsl
xsl/manpages/table.xsl
xsl/manpages/utility.xsl

index 21ce5b0b7d6e9b63831a717da847c096ede22e66..ff24821955e55fb08ae0f8fffe77e017545830fe 100644 (file)
@@ -30,7 +30,7 @@
   <xsl:text>)</xsl:text>
   <xsl:text>&#x2580;</xsl:text>
   <xsl:call-template name="italic">
-    <xsl:with-param name="node" select="exsl:node-set(normalize-space(.))"/>
+    <xsl:with-param name="node" select="."/>
     <xsl:with-param name="context" select="."/>
   </xsl:call-template>
 </xsl:template>
   <xsl:text>&#10;</xsl:text>
   <!-- * If we have a group of Synopfragments, we only want to output a -->
   <!-- * line of space before the first; so when we find a Synopfragment -->
-  <!-- * whose first preceding sibling is another Synopfragment, we back -->
-  <!-- * use the pinch-together template to close up the line of space -->
+  <!-- * which has another Synopfragment as a following sibling, we use-->
+  <!-- * the pinch-together template to close up the line of space -->
   <!-- * that would otherwise be generated by the .HP macro -->
-  <xsl:if test="preceding-sibling::*[1][self::synopfragment]">
+  <xsl:if test="following-sibling::*[self::synopfragment]">
     <xsl:call-template name="pinch.together"/>
   </xsl:if>
   <xsl:text>.HP </xsl:text>
-  <!-- * For each Synopfragment, make a hanging paragraph, with the -->
-  <!-- * indent calculated from the length of the generated number -->
-  <!-- * used as a reference + pluse 3 characters (for the open and -->
-  <!-- * close parens around the number, plus a space). -->
-  <xsl:value-of select="string-length (normalize-space ($snum)) + 3"/>
+  <xsl:text>\w'</xsl:text>
+  <xsl:text>(</xsl:text>
+  <xsl:value-of select="$snum"/>
+  <xsl:text>)</xsl:text>
+  <xsl:text>\ 'u</xsl:text>
   <xsl:text>&#10;</xsl:text>
   <xsl:text>(</xsl:text>
   <xsl:value-of select="$snum"/>
   <xsl:text>)</xsl:text>
-  <xsl:text> </xsl:text>
+  <xsl:text>\ </xsl:text>
   <xsl:apply-templates/>
 </xsl:template>
 
   <xsl:if test="$man.hyphenate != 0">
     <xsl:text>.hy 0&#10;</xsl:text>
   </xsl:if>
+  <xsl:call-template name="synopsis-block-start"/>
   <xsl:text>.HP </xsl:text>
-  <xsl:value-of select="string-length (normalize-space (command)) + 1"/>
+  <xsl:text>\w'</xsl:text>
+  <xsl:variable name="command">
+    <xsl:apply-templates select="command"/>
+  </xsl:variable>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="normalize-space($command)"/>
+    <xsl:with-param name="target" select="' '"/>
+    <xsl:with-param name="replacement" select="'\ '"/>
+  </xsl:call-template>
+  <xsl:text>\ 'u</xsl:text>
   <xsl:text>&#10;</xsl:text>
-  <xsl:call-template name="verbatim-block-start"/>
   <xsl:apply-templates/>
   <xsl:text>&#10;</xsl:text>
-  <xsl:call-template name="verbatim-block-end"/>
+  <xsl:call-template name="synopsis-block-end"/>
   <!-- * if justification is enabled by default, turn it back on -->
   <xsl:if test="$man.justify != 0">
     <xsl:text>.ad&#10;</xsl:text>
   <xsl:variable name="funcprototype">
     <xsl:apply-templates select="funcdef"/>
   </xsl:variable>
+  <xsl:call-template name="synopsis-block-start"/>
   <xsl:text>.HP </xsl:text>
-  <!-- * Hang Paragraph by length of string value of <funcdef> + 1 -->
-  <!-- * (because funcdef is always followed by one open paren char) -->
-  <xsl:value-of select="string-length (normalize-space ($funcprototype.string.value)) + 1"/>
+  <xsl:text>\w'</xsl:text>
+  <xsl:variable name="funcdef">
+    <xsl:apply-templates select="funcdef"/>
+  </xsl:variable>
+  <xsl:call-template name="string.subst">
+    <xsl:with-param name="string" select="normalize-space($funcdef)"/>
+    <xsl:with-param name="target" select="' '"/>
+    <xsl:with-param name="replacement" select="'\ '"/>
+  </xsl:call-template>
+  <xsl:text>('u</xsl:text>
   <xsl:text>&#10;</xsl:text>
-  <xsl:call-template name="verbatim-block-start"/>
   <xsl:text>.</xsl:text>
   <xsl:value-of select="$man.font.funcprototype"/>
   <xsl:text> </xsl:text>
     <xsl:apply-templates select="paramdef" mode="kr-paramdef-list"/>
     <xsl:text>.RE&#10;</xsl:text>
   </xsl:if>
-  <xsl:call-template name="verbatim-block-end"/>
+  <xsl:call-template name="synopsis-block-end"/>
 </xsl:template>
 
 <xsl:template match="funcdef">
index 74f94235d10e83b40e4561587886bc50e3017448..8321bd308f302f9161e048dcef48cb56c484b35a 100644 (file)
       <!-- *   Output table title                                           -->
       <!-- * ============================================================== -->
       <xsl:if test="$title != '' or parent::td">
+        <xsl:text>.sp&#10;</xsl:text>
         <xsl:call-template name="pinch.together"/>
         <xsl:text>.</xsl:text>
         <xsl:value-of select="$tbl.font.title"/>
index 6737eb8bc7a4c07fd713d0feedfdc785006c25aa..8212399ad49d9450084e3a8edf2bcb0d0342fc2f 100644 (file)
     <xsl:text>.ps +1&#10;</xsl:text>
   </xsl:template>
 
+  <xsl:template name="synopsis-block-start">
+    <xsl:text>.fam C&#10;</xsl:text>
+  </xsl:template>
+
+  <xsl:template name="synopsis-block-end">
+    <xsl:text>.fam&#10;</xsl:text>
+  </xsl:template>
+
   <!-- ================================================================== -->
 
   <!-- * NOTE TO DEVELOPERS: For ease of maintenance, the current -->
 
   <xsl:template name="pinch.together">
     <!-- * arcane roff code to suppress line spacing after headings -->
-    <xsl:text>.sp&#10;</xsl:text>
     <xsl:text>.it 1 an-trap&#10;</xsl:text>
     <xsl:text>.nr an-no-space-flag 1&#10;</xsl:text>
     <xsl:text>.nr an-break-flag 1&#10;</xsl:text>