Commit | Line | Data |
---|---|---|
738cb15a JF |
1 | <!-- manpage.xsl: various fixups to docbook -> manpage output |
2 | - | |
3 | - For now converts it adds a newline after preformatted text enclosed | |
4 | - in screen. | |
5 | - | |
6 | --> | |
7 | ||
8 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | |
9 | <xsl:template match="screen"> | |
10 | <xsl:text>.sp .nf </xsl:text> | |
11 | <xsl:apply-templates/> | |
12 | <xsl:text> .fi .sp </xsl:text> | |
13 | </xsl:template> | |
14 | ||
15 | <xsl:template match="simpara"> | |
16 | <xsl:variable name="content"> | |
17 | <xsl:apply-templates/> | |
18 | </xsl:variable> | |
19 | <xsl:value-of select="normalize-space($content)"/> | |
20 | <xsl:text> </xsl:text> | |
21 | <xsl:text>.sp </xsl:text> | |
22 | </xsl:template> | |
23 | ||
24 | <xsl:template match="address|literallayout|programlisting|screen|synopsis"> | |
25 | <!-- * Yes, address and synopsis are verbatim environments. --> | |
26 | ||
27 | <xsl:choose> | |
28 | <!-- * Check to see if this verbatim item is within a parent element that --> | |
29 | <!-- * allows mixed content. --> | |
30 | <!-- * --> | |
31 | <!-- * If it is within a mixed-content parent, then a line space is --> | |
32 | <!-- * already added before it by the mixed-block template, so we don't --> | |
33 | <!-- * need to add one here. --> | |
34 | <!-- * --> | |
35 | <!-- * If it is not within a mixed-content parent, then we need to add a --> | |
36 | <!-- * line space before it. --> | |
37 | <xsl:when test="parent::caption|parent::entry|parent::para| | |
38 | parent::td|parent::th" /> <!-- do nothing --> | |
39 | <xsl:otherwise> | |
40 | <xsl:text> </xsl:text> | |
41 | <xsl:text>.sp </xsl:text> | |
42 | </xsl:otherwise> | |
43 | </xsl:choose> | |
44 | <xsl:text>.nf </xsl:text> | |
45 | <xsl:apply-templates/> | |
46 | <xsl:text> </xsl:text> | |
47 | <xsl:text> .fi </xsl:text> | |
48 | <!-- * if first following sibling node of this verbatim --> | |
49 | <!-- * environment is a text node, output a line of space before it --> | |
50 | <xsl:if test="following-sibling::node()[1][name(.) = '']"> | |
51 | <xsl:text> </xsl:text> | |
52 | <xsl:text>.sp </xsl:text> | |
53 | </xsl:if> | |
54 | </xsl:template> | |
55 | </xsl:stylesheet> |