chiark / gitweb /
62f852034527cc8bb4263a6dc08557d64b38f99f
[elogind.git] / man / custom-html.xsl
1 <?xml version='1.0'?> <!--*-nxml-*-->
2
3 <!--
4   This file is part of systemd.
5
6   Copyright 2011 Lennart Poettering
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 -->
21
22 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
23
24 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
25
26 <!-- translate man page references to links to html pages -->
27 <xsl:template match="citerefentry[not(@project)]">
28   <a>
29     <xsl:attribute name="href">
30       <xsl:value-of select="refentrytitle"/><xsl:text>.html</xsl:text>
31     </xsl:attribute>
32     <xsl:call-template name="inline.charseq"/>
33   </a>
34 </xsl:template>
35
36 <xsl:template match="citerefentry[@project='man-pages'] | citerefentry[manvolnum='2'] | citerefentry[manvolnum='4']">
37   <a>
38     <xsl:attribute name="href">
39       <xsl:text>http://man7.org/linux/man-pages/man</xsl:text>
40       <xsl:value-of select="manvolnum"/>
41       <xsl:text>/</xsl:text>
42       <xsl:value-of select="refentrytitle"/>
43       <xsl:text>.</xsl:text>
44       <xsl:value-of select="manvolnum"/>
45       <xsl:text>.html</xsl:text>
46     </xsl:attribute>
47     <xsl:call-template name="inline.charseq"/>
48   </a>
49 </xsl:template>
50
51 <xsl:template match="citerefentry[@project='die-net']">
52   <a>
53     <xsl:attribute name="href">
54       <xsl:text>http://linux.die.net/man/</xsl:text>
55       <xsl:value-of select="manvolnum"/>
56       <xsl:text>/</xsl:text>
57       <xsl:value-of select="refentrytitle"/>
58     </xsl:attribute>
59     <xsl:call-template name="inline.charseq"/>
60   </a>
61 </xsl:template>
62
63 <xsl:template match="citerefentry[@project='mankier']">
64   <a>
65     <xsl:attribute name="href">
66       <xsl:text>https://www.mankier.com/</xsl:text>
67       <xsl:value-of select="manvolnum"/>
68       <xsl:text>/</xsl:text>
69       <xsl:value-of select="refentrytitle"/>
70     </xsl:attribute>
71     <xsl:call-template name="inline.charseq"/>
72   </a>
73 </xsl:template>
74
75 <xsl:template match="citerefentry[@project='archlinux']">
76   <a>
77     <xsl:attribute name="href">
78       <xsl:text>https://www.archlinux.org/</xsl:text>
79       <xsl:value-of select="refentrytitle"/>
80       <xsl:text>/</xsl:text>
81       <xsl:value-of select="refentrytitle"/>
82       <xsl:text>.</xsl:text>
83       <xsl:value-of select="manvolnum"/>
84       <xsl:text>.html</xsl:text>
85     </xsl:attribute>
86     <xsl:call-template name="inline.charseq"/>
87   </a>
88 </xsl:template>
89
90 <xsl:template match="citerefentry[@project='freebsd']">
91   <a>
92     <xsl:attribute name="href">
93       <xsl:text>https://www.freebsd.org/cgi/man.cgi?</xsl:text>
94       <xsl:value-of select="refentrytitle"/>
95       <xsl:text>(</xsl:text>
96       <xsl:value-of select="manvolnum"/>
97       <xsl:text>)</xsl:text>
98     </xsl:attribute>
99     <xsl:call-template name="inline.charseq"/>
100   </a>
101 </xsl:template>
102
103 <xsl:template match="citerefentry[@project='dbus']">
104   <a>
105     <xsl:attribute name="href">
106       <xsl:text>http://dbus.freedesktop.org/doc/</xsl:text>
107       <xsl:value-of select="refentrytitle"/>
108       <xsl:text>.</xsl:text>
109       <xsl:value-of select="manvolnum"/>
110       <xsl:text>.html</xsl:text>
111     </xsl:attribute>
112     <xsl:call-template name="inline.charseq"/>
113   </a>
114 </xsl:template>
115
116 <xsl:template match="refsect1/title|refsect1/info/title">
117   <!-- the ID is output in the block.object call for refsect1 -->
118   <h2>
119     <xsl:attribute name="id">
120       <xsl:call-template name="inline.charseq"/>
121     </xsl:attribute>
122     <xsl:apply-templates/>
123     <a>
124       <xsl:attribute name="class">
125         <xsl:text>headerlink</xsl:text>
126       </xsl:attribute>
127       <xsl:attribute name="title">
128         <xsl:text>Permalink to this headline</xsl:text>
129       </xsl:attribute>
130       <xsl:attribute name="href">
131         <xsl:text>#</xsl:text>
132         <xsl:call-template name="inline.charseq"/>
133       </xsl:attribute>
134       <xsl:text>¶</xsl:text>
135     </a>
136   </h2>
137 </xsl:template>
138
139 <xsl:template match="refsect2/title|refsect2/info/title">
140   <h3>
141     <xsl:attribute name="id">
142       <xsl:call-template name="inline.charseq"/>
143     </xsl:attribute>
144     <xsl:apply-templates/>
145     <a>
146       <xsl:attribute name="class">
147         <xsl:text>headerlink</xsl:text>
148       </xsl:attribute>
149       <xsl:attribute name="title">
150         <xsl:text>Permalink to this headline</xsl:text>
151       </xsl:attribute>
152       <xsl:attribute name="href">
153         <xsl:text>#</xsl:text>
154         <xsl:call-template name="inline.charseq"/>
155       </xsl:attribute>
156       <xsl:text>¶</xsl:text>
157     </a>
158   </h3>
159 </xsl:template>
160
161 <xsl:template match="varlistentry">
162   <dt>
163     <xsl:attribute name="id">
164       <xsl:call-template name="inline.charseq">
165         <xsl:with-param name="content">
166           <xsl:copy-of select="term[position()=1]" />
167         </xsl:with-param>
168       </xsl:call-template>
169     </xsl:attribute>
170     <xsl:apply-templates select="term"/>
171     <a>
172       <xsl:attribute name="class">
173         <xsl:text>headerlink</xsl:text>
174       </xsl:attribute>
175       <xsl:attribute name="title">
176         <xsl:text>Permalink to this term</xsl:text>
177       </xsl:attribute>
178       <xsl:attribute name="href">
179         <!--        <xsl:call-template name="href.target.uri" /> -->
180         <xsl:text>#</xsl:text>
181         <xsl:call-template name="inline.charseq">
182           <xsl:with-param name="content">
183             <xsl:copy-of select="term[position()=1]" />
184           </xsl:with-param>
185         </xsl:call-template>
186       </xsl:attribute>
187       <xsl:text>¶</xsl:text>
188     </a>
189   </dt>
190   <dd>
191     <xsl:apply-templates select="listitem"/>
192   </dd>
193 </xsl:template>
194
195
196 <!-- add Index link at top of page -->
197 <xsl:template name="user.header.content">
198   <style>
199     a.headerlink {
200       color: #c60f0f;
201       font-size: 0.8em;
202       padding: 0 4px 0 4px;
203       text-decoration: none;
204       visibility: hidden;
205     }
206
207     a.headerlink:hover {
208       background-color: #c60f0f;
209       color: white;
210     }
211
212     h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
213       visibility: visible;
214     }
215   </style>
216
217   <a>
218     <xsl:attribute name="href">
219       <xsl:text>index.html</xsl:text>
220     </xsl:attribute>
221     <xsl:text>Index </xsl:text>
222   </a>
223
224   <span style="float:right">
225     <xsl:text>elogind </xsl:text>
226     <xsl:value-of select="$elogind.version"/>
227   </span>
228   <hr/>
229 </xsl:template>
230
231 <xsl:template match="literal">
232   <xsl:text>"</xsl:text>
233   <xsl:call-template name="inline.monoseq"/>
234   <xsl:text>"</xsl:text>
235 </xsl:template>
236
237 <!-- Switch things to UTF-8, ISO-8859-1 is soo yesteryear -->
238 <xsl:output method="html" encoding="UTF-8" indent="no"/>
239
240 </xsl:stylesheet>