Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add manpage XSL from git and enhance with literallayout fixes
It ensures that .sp tags will be properly output so they do not appear in the rendered manpages. Grabed from git's Documentation/callouts.xsl file. From the git's commit 7ef0435088f41165ece95b6f226d3c15438505a5: This is just a random hack to work around problems people seem to be seeing in manpage backend of xmlto (it appears we are getting ".sp" at the end of line without line break). Additionally, output an empty line after literallayout blocks (.nf .fi) so that any text following it will appear in a separate block.
- Loading branch information
Showing
2 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!-- manpage.xsl: various fixups to docbook -> manpage output | ||
- | ||
- For now converts it adds a newline after preformatted text enclosed | ||
- in screen. | ||
- | ||
--> | ||
|
||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||
<xsl:template match="screen"> | ||
<xsl:text>.sp .nf </xsl:text> | ||
<xsl:apply-templates/> | ||
<xsl:text> .fi .sp </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> </xsl:text> | ||
<xsl:text>.sp </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> </xsl:text> | ||
<xsl:text>.sp </xsl:text> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:text>.nf </xsl:text> | ||
<xsl:apply-templates/> | ||
<xsl:text> </xsl:text> | ||
<xsl:text> .fi </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> </xsl:text> | ||
<xsl:text>.sp </xsl:text> | ||
</xsl:if> | ||
</xsl:template> | ||
</xsl:stylesheet> |