fix ctrl+A not working in location bar
[kdelibs.git] / kdoctools / customization / kde-man.xsl
blob8e86868118b28517e2b5c613756218477a267314
1 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
2 <!-- vim:set syntax=xml ts=2 et: -->
3 <xsl:import href="../docbook/xsl/manpages/docbook.xsl"/>
5 <!-- Disable the automatically generated AUTHORS section by overloading the
6 respective template and making it a no-op. -->
7 <xsl:template match="articleinfo|bookinfo|refentryinfo" mode="authorsect"/>
9 <!--
10 Copied from ../docbook/xsl/manpages/docbook.xsl and changed it so that the
11 output file's name is harccoded to 'manpage.troff', and the quiet parameter
12 is set to 1 to avoid the 'Writing foo.X' message which write.text.chunk
13 prints.
14 -->
15 <xsl:template match="refentry">
17 <xsl:variable name="section">
18 <xsl:choose>
19 <xsl:when test="refmeta/manvolnum">
20 <xsl:value-of select="refmeta/manvolnum[1]"/>
21 </xsl:when>
22 <xsl:when test=".//funcsynopsis">3</xsl:when>
23 <xsl:otherwise>1</xsl:otherwise>
24 </xsl:choose>
25 </xsl:variable>
27 <xsl:variable name="name" select="refnamediv/refname[1]"/>
29 <!-- standard man page width is 64 chars; 6 chars needed for the two
30 (x) volume numbers, and 2 spaces, leaves 56 -->
31 <xsl:variable name="twidth" select="(56 - string-length(refmeta/refentrytitle)) div 2"/>
33 <xsl:variable name="reftitle"
34 select="substring(refmeta/refentrytitle, 1, $twidth)"/>
36 <xsl:variable name="title">
37 <xsl:choose>
38 <xsl:when test="refentryinfo/title">
39 <xsl:value-of select="refentryinfo/title"/>
40 </xsl:when>
41 <xsl:when test="../referenceinfo/title">
42 <xsl:value-of select="../referenceinfo/title"/>
43 </xsl:when>
44 </xsl:choose>
45 </xsl:variable>
47 <xsl:variable name="date">
48 <xsl:choose>
49 <xsl:when test="refentryinfo/date">
50 <xsl:value-of select="refentryinfo/date"/>
51 </xsl:when>
52 <xsl:when test="../referenceinfo/date">
53 <xsl:value-of select="../referenceinfo/date"/>
54 </xsl:when>
55 </xsl:choose>
56 </xsl:variable>
58 <xsl:variable name="productname">
59 <xsl:choose>
60 <xsl:when test="refentryinfo/productname">
61 <xsl:value-of select="refentryinfo/productname"/>
62 </xsl:when>
63 <xsl:when test="../referenceinfo/productname">
64 <xsl:value-of select="../referenceinfo/productname"/>
65 </xsl:when>
66 </xsl:choose>
67 </xsl:variable>
69 <xsl:variable name="filename">
70 <xsl:text>manpage.troff</xsl:text>
71 </xsl:variable>
73 <xsl:call-template name="write.text.chunk">
74 <xsl:with-param name="quiet" select="1"/>
75 <xsl:with-param name="filename" select="$filename"/>
76 <xsl:with-param name="content">
77 <xsl:text>.\"Generated by db2man.xsl. Don't modify this, modify the source.
78 .de Sh \" Subsection
79 .br
80 .if t .Sp
81 .ne 5
82 .PP
83 \fB\\$1\fR
84 .PP
86 .de Sp \" Vertical space (when we can't use .PP)
87 .if t .sp .5v
88 .if n .sp
90 .de Ip \" List item
91 .br
92 .ie \\n(.$>=3 .ne \\$3
93 .el .ne 3
94 .IP "\\$1" \\$2
96 .TH "</xsl:text>
97 <xsl:value-of select="translate($reftitle,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
98 <xsl:text>" </xsl:text>
99 <xsl:value-of select="$section"/>
100 <xsl:text> "</xsl:text>
101 <xsl:value-of select="normalize-space($date)"/>
102 <xsl:text>" "</xsl:text>
103 <xsl:value-of select="normalize-space($productname)"/>
104 <xsl:text>" "</xsl:text>
105 <xsl:value-of select="$title"/>
106 <xsl:text>"
107 </xsl:text>
108 <xsl:apply-templates/>
109 <xsl:text>&#10;</xsl:text>
111 <!-- Author section -->
112 <xsl:choose>
113 <xsl:when test="refentryinfo//author">
114 <xsl:apply-templates select="refentryinfo" mode="authorsect"/>
115 </xsl:when>
116 <xsl:when test="/book/bookinfo//author">
117 <xsl:apply-templates select="/book/bookinfo" mode="authorsect"/>
118 </xsl:when>
119 <xsl:when test="/article/articleinfo//author">
120 <xsl:apply-templates select="/article/articleinfo" mode="authorsect"/>
121 </xsl:when>
122 </xsl:choose>
124 </xsl:with-param>
125 </xsl:call-template>
126 <!-- Now generate stub include pages for every page documented in
127 this refentry (except the page itself) -->
128 <xsl:for-each select="refnamediv/refname">
129 <xsl:if test=". != $name">
130 <xsl:call-template name="write.text.chunk">
131 <xsl:with-param name="filename"
132 select="concat(normalize-space(.), '.', $section)"/>
133 <xsl:with-param name="content" select="concat('.so man',
134 $section, '/', $name, '.', $section, '&#10;')"/>
135 </xsl:call-template>
136 </xsl:if>
137 </xsl:for-each>
138 </xsl:template>
140 </xsl:stylesheet>