Re: Garbled man pages (.sp instead of newline)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Carl Worth <cworth@...>
Cc: <git@...>
Date: Friday, December 1, 2006 - 3:01 pm

Carl Worth <cworth@cworth.org> wrote Fri, Dec 01, 2006:

The problem is that a newline is not inserted before the ".sp".  I (and
apparently a lot of other people on #git) thought it was just something
broken by the system. It appears that the DocBook XSL files got broken
between 1.69.0 and 1.69.1, but it appears to have been fixed upstream (I
didn't try it by from looking at the xsl/manpages/block.xsl file it
seems to insert a newline again before inserting a ".sp")

Git already has a custom XSL file to handle callouts so this might be
the right place to insert a workaround for this although I don't know if
it breaks systems that do not have this problem. The patch that I have
included is based on what I plan to add to tig. It would be great to
hear if it breaks manpages build on systems that do not have this ".sp"
problem.

I also have another small fix to insert an empty line after a code
block. Currently, the following paragraph will immediately follow the
code block which hurts readability a bit.

BTW, it might make sense to rename callouts.xsl to manpage.xsl if
something like this and the other fix I mentioned is acceptable.

diff --git a/Documentation/callouts.xsl b/Documentation/callouts.xsl
index ad03755..d016b3b 100644
--- a/Documentation/callouts.xsl
+++ b/Documentation/callouts.xsl
@@ -13,4 +13,44 @@
 	<xsl:apply-templates/>
 	<xsl:text>.br&#10;</xsl:text>
 </xsl:template>
+<xsl:template match="simpara">
+  <xsl:variable name="content">
+    <xsl:apply-templates/>
+  </xsl:variable>
+  <xsl:value-of select="normalize-space($content)"/>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:text>.sp&#10;</xsl:text>
+</xsl:template>
+
+<xsl:template match="address|literallayout|programlisting|screen|synopsis">
+  <!-- * Yes, address and synopsis are verbatim environments. -->
+
+  <xsl:choose>
+    <!-- * Check to see if this verbatim item is within a parent element that -->
+    <!-- * allows mixed content. -->
+    <!-- * -->
+    <!-- * If it is within a mixed-content parent, then a line space is -->
+    <!-- * already added before it by the mixed-block template, so we don't -->
+    <!-- * need to add one here. -->
+    <!-- * -->
+    <!-- * If it is not within a mixed-content parent, then we need to add a -->
+    <!-- * line space before it. -->
+    <xsl:when test="parent::caption|parent::entry|parent::para|
+                    parent::td|parent::th" /> <!-- do nothing -->
+    <xsl:otherwise>
+      <xsl:text>&#10;</xsl:text>
+      <xsl:text>.sp&#10;</xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+  <xsl:text>.nf&#10;</xsl:text>
+  <xsl:apply-templates/>
+  <xsl:text>&#10;</xsl:text>
+  <xsl:text>.fi&#10;</xsl:text>
+  <!-- * if first following sibling node of this verbatim -->
+  <!-- * environment is a text node, output a line of space before it -->
+  <xsl:if test="following-sibling::node()[1][name(.) = '']">
+    <xsl:text>&#10;</xsl:text>
+    <xsl:text>.sp&#10;</xsl:text>
+  </xsl:if>
+</xsl:template>
 </xsl:stylesheet>

-- 
Jonas Fonseca
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Garbled man pages (.sp instead of newline), Carl Worth, (Fri Dec 1, 1:57 pm)
Re: Garbled man pages (.sp instead of newline), Jonas Fonseca, (Fri Dec 1, 3:01 pm)