Joined is a patch that tries to handle line breaks in manpage output.

        --julm

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

--- old/asciidoc-8.6.7/docbook-xsl/manpage.xsl	2011-04-16 00:20:30.000000000 +0200
+++ new/asciidoc-8.6.7/docbook-xsl/manpage.xsl	2012-08-29 12:30:59.690610018 +0200
@@ -27,5 +27,109 @@
 <xsl:template name="format.links.list">
 </xsl:template>
 
+<!-- Line break -->
+	<!-- NOTE: delete each non-<?asciidoc-br?> node -->
+	<xsl:template
+	 mode="asciidoc-br"
+	 match="simpara/node()[not(self::processing-instruction('asciidoc-br'))]"/>
+	<!-- NOTE: associate each <?asciidoc-br?> to its following nodes -->
+	<xsl:key
+	 name="simpara-asciidoc-br"
+	 match="simpara/node()[not(self::processing-instruction('asciidoc-br'))]"
+	 use="generate-id(preceding-sibling::processing-instruction('asciidoc-br')[1])"/>
+	<!-- NOTE: not-first <?asciidoc-br?> -->
+	<xsl:template
+	 mode="asciidoc-br"
+	 match="simpara/processing-instruction('asciidoc-br')">
+		<xsl:variable name="after">
+			<xsl:apply-templates select="key('simpara-asciidoc-br', generate-id())"/>
+		 </xsl:variable>
+		<xsl:variable name="after-normalized">
+			<xsl:value-of select="normalize-space($after)"/>
+		 </xsl:variable>
+		<xsl:if test="$after-normalized != ''">
+			<xsl:value-of select="concat('\&#38;',$after-normalized,'&#10;.br&#10;')"/>
+		 </xsl:if>
+	 </xsl:template>
+	<!-- NOTE: first <?asciidoc-br?> -->
+	<xsl:template
+	 mode="asciidoc-br"
+	 match="simpara/processing-instruction('asciidoc-br')
+		 [not(preceding-sibling::processing-instruction('asciidoc-br'))]">
+		<xsl:variable name="before">
+			<xsl:apply-templates select="preceding-sibling::node()"/>
+		 </xsl:variable>
+		<xsl:variable name="after">
+			<xsl:apply-templates select="key('simpara-asciidoc-br', generate-id())"/>
+		 </xsl:variable>
+		<xsl:variable name="before-normalized">
+			<xsl:value-of select="normalize-space($before)"/>
+		 </xsl:variable>
+		<xsl:variable name="after-normalized">
+			<xsl:value-of select="normalize-space($after)"/>
+		 </xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$before-normalized = '' and $after-normalized = ''">
+			 </xsl:when>
+			<xsl:when test="$before-normalized = ''">
+				<xsl:value-of select="concat('\&#38;',$after-normalized,'&#10;.br&#10;')"/>
+			 </xsl:when>
+			<xsl:when test="$after-normalized = ''">
+				<xsl:value-of select="concat('\&#38;',$before-normalized,'&#10;.br&#10;')"/>
+			 </xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="concat('\&#38;',$before-normalized,'&#10;.br&#10;','\&#38;',$after-normalized,'&#10;.br&#10;')"/>
+			 </xsl:otherwise>
+		 </xsl:choose>
+	 </xsl:template>
+	
+	<!-- NOTE: rewrite docbook-xsl/manpages/block.xsl's simpara template
+	     to insert the application of asciidoc-br templates -->
+	<xsl:template match="simpara">
+		<xsl:choose>
+			<xsl:when test="ancestor::footnote or
+			                ancestor::annotation or
+			                ancestor::authorblurb or
+			                ancestor::personblurb or
+			                ancestor::callout">
+				<xsl:if test="preceding-sibling::*[not(name() = '')]">
+					<xsl:text>.sp</xsl:text>
+					<xsl:text>&#10;</xsl:text>
+					<xsl:text>.RS 4n</xsl:text>
+					<xsl:text>&#10;</xsl:text>
+				 </xsl:if>
+			 </xsl:when>
+			<xsl:otherwise>
+				<xsl:text>.sp</xsl:text>
+				<xsl:text>&#10;</xsl:text>
+			 </xsl:otherwise>
+		 </xsl:choose>
+		<xsl:choose>
+			<xsl:when test="not(child::processing-instruction('asciidoc-br'))">
+				<xsl:variable name="content">
+					<xsl:apply-templates/>
+				 </xsl:variable>
+				<xsl:value-of select="normalize-space($content)"/>
+			 </xsl:when>
+			<xsl:otherwise>
+				<xsl:apply-templates mode="asciidoc-br"/>
+			 </xsl:otherwise>
+		 </xsl:choose>
+		<xsl:text>&#10;</xsl:text>
+	 </xsl:template>
+	<!-- NOTE: avoid the above template to overwrite
+	     docbook-xsl/manpages/lists.xsl's simpara template -->
+	<xsl:template match="simpara[ancestor::listitem or ancestor::step or ancestor::glossdef]">
+		<xsl:call-template name="mixed-block"/>
+		<xsl:text>&#10;</xsl:text>
+		<xsl:if test="following-sibling::*[1][
+			self::para or
+			self::simpara or
+			self::remark
+			]">
+			<xsl:text>.sp&#10;</xsl:text>
+		 </xsl:if>
+	 </xsl:template>
+
 </xsl:stylesheet>
 

Reply via email to