]> granicus.if.org Git - docbook-dsssl/commitdiff
Fixed bug that caused literal .sp to show up in output. (Thanks to
authorMichael Smith <xmldoc@users.sourceforge.net>
Fri, 5 Aug 2005 08:09:50 +0000 (08:09 +0000)
committerMichael Smith <xmldoc@users.sourceforge.net>
Fri, 5 Aug 2005 08:09:50 +0000 (08:09 +0000)
Costin Stroie for reporting).

WARNING: One of the consequences of this change is that the
stylesheet no longer generates spaces at the end of certain lines.
I had it doing that as a sort of hack to prevent certain kinds of
problems in output. It seems like the hack my no longer be
necessary. But if I am wrong, this change may cause spaces to show
up at the beginning of some lines in "mixed content". If you see
those, then this change has introduced a regression, and I will
need to go back and figure out the right way to fix it (instead of
the kludgy way I was doing it before.

Also, instances like the following were showing up in some cases.

  .PP
  .sp

That is, a .PP macro immediately followed by a .sp macro. I can
think of no good read to ever generate that, and I am not sure why
it is getting generated. So I have taked the lazy way out and
caused the stylesheet to now strip out the .sp from all such
instances, leaving just the .PP

xsl/manpages/utility.xsl
xsl/params/man.string.subst.map.xml

index 585378126ef8e41f8698242467e811bc7692fabf..726df8176670bdab5c85d8ac586114b2ac4c1440 100644 (file)
         <!-- * verbatim, presumably to support some kludge; I removed it -->
         <xsl:when test="self::address|self::literallayout|self::programlisting|
                         self::screen|self::synopsis">
+          <xsl:text>&#10;</xsl:text>
           <xsl:text>.sp&#10;</xsl:text>
           <xsl:apply-templates select="."/>
         </xsl:when>
         <xsl:when test="self::text()">
           <!-- * Check to see if this is a text node. -->
           <!-- * -->
-          <!-- * If so, take any multiple whitespace at the beginning or end of -->
-          <!-- * it, and replace it with a space plus a linebreak. -->
+          <!-- * If so, replace all whitespace at the beginning or end of it -->
+          <!-- * with a single linebreak. -->
           <!-- * -->
-          <!-- * This hack results in some ugliness in the generated roff -->
-          <!-- * source. But it ensures the whitespace around text nodes in mixed -->
-          <!-- * content gets preserved; without the hack, that whitespace -->
-          <!-- * effectively gets gobbled. -->
-          <!-- * -->
-          <!-- * Note if the node is just space, we just pass it through -->
-          <!-- * without (re)adding a line break. -->
-          <!-- * -->
-          <!-- * There must be a better way to do with this...  -->
           <xsl:variable name="content">
             <xsl:apply-templates select="."/>
           </xsl:variable>
                     preceding-sibling::procedure[1]
                     )
                     ">
-            <xsl:text> &#10;</xsl:text>
+            <xsl:text>&#10;</xsl:text>
           </xsl:if>
           <xsl:value-of select="normalize-space($content)"/>
           <xsl:if
               test="translate(substring(., string-length(.), 1),'&#9;&#10;&#13; ','    ')  = ' '
                     and following-sibling::node()[name(.)!='']
                     ">
-            <xsl:text> </xsl:text>
             <xsl:if test="normalize-space($content) != ''">
               <xsl:text>&#10;</xsl:text>
             </xsl:if>
index 79199950af7887c4d7d937ef64e1480fb0baa759..6b5d5f727d0b2e101f13e48a25502145dae3b42c 100644 (file)
   <!-- * now, we need to restore single-hypens in all roff requests -->
   <!-- * (because the substitution above added backslashes before them) -->
   <substitution oldstring=".sp \-" newstring=".sp -"/>
+  <substitution oldstring=".PP&#10;.sp" newstring=".PP"/>
   <substitution oldstring=".it 1 an\-trap" newstring=".it 1 an-trap"/>
   <substitution oldstring=".nr an\-no\-space\-flag 1" newstring=".nr an-no-space-flag 1"/>
   <substitution oldstring=".nr an\-break\-flag 1" newstring=".nr an-break-flag 1"/>
   <!-- * squeeze multiple newlines before a roff request  -->
   <substitution oldstring="&#10;&#10;." newstring="&#10;."/>
+  <!-- * remove any .sp occurences that directly follow a .PP  -->
+  <substitution oldstring=".PP&#10;.sp" newstring=".PP"/>
   <!-- * squeeze multiple newlines after start of no-fill (verbatim) env. -->
   <substitution oldstring=".nf&#10;&#10;" newstring=".nf&#10;"/>
   <!-- * an apostrophe at the beginning of a line gets interpreted as a -->