Next update of VFS modules development guide
[Samba.git] / docs / xslt / man.xsl
blob99b2112cb3af7c7d63d748dc7334d9c9cb9b8ca0
1 <?xml version='1.0'?>
2 <!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
3 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4 version='1.0'>
6 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
8 <xsl:param name="chunk.section.depth" select="0"/>
9 <xsl:param name="chunk.first.sections" select="1"/>
10 <xsl:param name="use.id.as.filename" select="1"/>
12 <!--
13 Our ulink stylesheet omits @url part if content was specified
14 -->
15 <xsl:template match="ulink">
16 <xsl:variable name="content">
17 <xsl:apply-templates/>
18 </xsl:variable>
19 <xsl:if test="$content = ''">
20 <xsl:text>: </xsl:text>
21 </xsl:if>
22 <xsl:if test="$content != ''">
23 <xsl:value-of select="$content" />
24 </xsl:if>
25 <xsl:if test="$content = ''">
26 <xsl:apply-templates mode="italic" select="@url" />
27 </xsl:if>
28 </xsl:template>
30 <xsl:template match="itemizedlist/listitem">
31 <!-- * We output a real bullet here (rather than, "\(bu", -->
32 <!-- * the roff bullet) because, when we do character-map -->
33 <!-- * processing before final output, the character-map will -->
34 <!-- * handle conversion of the &#x2022; to "\(bu" for us -->
35 <xsl:text>&#10;</xsl:text>
36 <xsl:text>.sp</xsl:text>
37 <xsl:text>&#10;</xsl:text>
38 <xsl:text>.RS</xsl:text>
39 <xsl:if test="not($list-indent = '')">
40 <xsl:text> </xsl:text>
41 <xsl:value-of select="$list-indent"/>
42 </xsl:if>
43 <xsl:text>&#10;</xsl:text>
44 <!-- * if "n" then we are using "nroff", which means the output is for -->
45 <!-- * TTY; so we do some fixed-width-font hackery with \h to make a -->
46 <!-- * hanging indent (instead of using .IP, which has some -->
47 <!-- * undesirable side effects under certain circumstances) -->
48 <xsl:call-template name="roff-if-else-start"/>
49 <xsl:text>\h'-</xsl:text>
50 <xsl:choose>
51 <xsl:when test="not($list-indent = '')">
52 <xsl:text>0</xsl:text>
53 <xsl:value-of select="$list-indent"/>
54 </xsl:when>
55 <xsl:otherwise>
56 <xsl:text>\n(INu</xsl:text>
57 </xsl:otherwise>
58 </xsl:choose>
59 <xsl:text>'</xsl:text>
60 <xsl:text>&#x2022;</xsl:text>
61 <xsl:text>\h'+</xsl:text>
62 <xsl:choose>
63 <xsl:when test="not($list-indent = '')">
64 <xsl:text>0</xsl:text>
65 <xsl:value-of select="$list-indent - 1"/>
66 </xsl:when>
67 <xsl:otherwise>
68 <xsl:text>\n(INu-1</xsl:text>
69 </xsl:otherwise>
70 </xsl:choose>
71 <xsl:text>'\c&#10;</xsl:text>
72 <!-- * else, we are not using for "nroff", but instead "troff" - which -->
73 <!-- * means not for TTY, but for PS or whatever; so we’re not using a -->
74 <!-- * fixed-width font, so use a real .IP instead -->
75 <xsl:call-template name="roff-else"/>
76 <!-- * .IP generates a blank like of space, so let’s go backwards one -->
77 <!-- * line up to compensate for that -->
78 <xsl:text>.sp -1&#10;</xsl:text>
79 <xsl:text>.IP \(bu 2.3&#10;</xsl:text>
80 <!-- * The value 2.3 is the amount of indentation; we use 2.3 instead -->
81 <!-- * of 2 because when the font family is New Century Schoolbook it -->
82 <!-- * seems to require the extra space. -->
83 <xsl:call-template name="roff-if-end"/>
84 <xsl:apply-templates/>
85 <xsl:if test=" following-sibling::listitem">
86 <xsl:text>&#10;.RE&#10;</xsl:text>
87 </xsl:if>
88 </xsl:template>
90 <xsl:template match="itemizedlist|orderedlist|procedure">
91 <xsl:if test="title">
92 <xsl:text>.PP&#10;</xsl:text>
93 <xsl:call-template name="bold">
94 <xsl:with-param name="node" select="title"/>
95 <xsl:with-param name="context" select="."/>
96 </xsl:call-template>
97 <xsl:text>&#10;</xsl:text>
98 </xsl:if>
99 <!-- * DocBook allows just about any block content to appear in -->
100 <!-- * lists before the actual list items, so we need to get that -->
101 <!-- * content (if any) before getting the list items -->
102 <xsl:apply-templates
103 select="*[not(self::listitem) and not(self::title)]"/>
104 <xsl:apply-templates select="listitem"/>
105 <xsl:if test="(parent::para or parent::listitem) or following-sibling::node()">
106 <xsl:text>.sp&#10;</xsl:text>
107 <xsl:text>.RE&#10;</xsl:text>
108 </xsl:if>
109 </xsl:template>
111 <xsl:template match="refsect3">
112 <xsl:text>&#10;.SS "</xsl:text>
113 <xsl:value-of select="title[1]"/>
114 <xsl:text>"&#10;</xsl:text>
115 <xsl:apply-templates/>
116 </xsl:template>
118 <!-- ================================================================== -->
119 <!-- These macros are from Docbook manpages XSLT development tree -->
120 <!-- help to maintain manpage generation clean when difference between -->
121 <!-- roff processors is important to note. -->
123 <xsl:template name="roff-if-else-start">
124 <xsl:param name="condition">n</xsl:param>
125 <xsl:text>.ie </xsl:text>
126 <xsl:value-of select="$condition"/>
127 <xsl:text> \{\&#10;</xsl:text>
128 </xsl:template>
130 <xsl:template name="roff-if-start">
131 <xsl:param name="condition">n</xsl:param>
132 <xsl:text>.if </xsl:text>
133 <xsl:value-of select="$condition"/>
134 <xsl:text> \{\&#10;</xsl:text>
135 </xsl:template>
137 <xsl:template name="roff-else">
138 <xsl:text>.\}&#10;</xsl:text>
139 <xsl:text>.el \{\&#10;</xsl:text>
140 </xsl:template>
142 <xsl:template name="roff-if-end">
143 <xsl:text>.\}&#10;</xsl:text>
144 </xsl:template>
146 </xsl:stylesheet>