chiark / gitweb /
man: provide "permalinks" to sections and terms
[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">
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="refsect1/title|refsect1/info/title">
37   <!-- the ID is output in the block.object call for refsect1 -->
38   <h2>
39     <xsl:attribute name="id">
40       <xsl:call-template name="inline.charseq"/>
41     </xsl:attribute>
42     <xsl:apply-templates/>
43     <a>
44       <xsl:attribute name="class">
45         <xsl:text>headerlink</xsl:text>
46       </xsl:attribute>
47       <xsl:attribute name="title">
48         <xsl:text>Permalink to this headline</xsl:text>
49       </xsl:attribute>
50       <xsl:attribute name="href">
51         <!--        <xsl:call-template name="href.target.uri" /> -->
52         <xsl:text>#</xsl:text>
53         <xsl:call-template name="inline.charseq"/>
54       </xsl:attribute>
55       <xsl:text>¶</xsl:text>
56     </a>
57   </h2>
58 </xsl:template>
59
60 <xsl:template match="varlistentry">
61   <dt>
62     <xsl:attribute name="id">
63       <xsl:call-template name="inline.charseq">
64         <xsl:with-param name="content">
65           <xsl:copy-of select="term[position()=1]" />
66         </xsl:with-param>
67       </xsl:call-template>
68     </xsl:attribute>
69     <xsl:apply-templates select="term"/>
70     <a>
71       <xsl:attribute name="class">
72         <xsl:text>headerlink</xsl:text>
73       </xsl:attribute>
74       <xsl:attribute name="title">
75         <xsl:text>Permalink to this term</xsl:text>
76       </xsl:attribute>
77       <xsl:attribute name="href">
78         <!--        <xsl:call-template name="href.target.uri" /> -->
79         <xsl:text>#</xsl:text>
80         <xsl:call-template name="inline.charseq">
81           <xsl:with-param name="content">
82             <xsl:copy-of select="term[position()=1]" />
83           </xsl:with-param>
84         </xsl:call-template>
85       </xsl:attribute>
86       <xsl:text>¶</xsl:text>
87     </a>
88   </dt>
89   <dd>
90     <xsl:apply-templates select="listitem"/>
91   </dd>
92 </xsl:template>
93
94
95 <!-- add Index link at top of page -->
96 <xsl:template name="user.header.content">
97   <style>
98     a.headerlink {
99       color: #c60f0f;
100       font-size: 0.8em;
101       padding: 0 4px 0 4px;
102       text-decoration: none;
103       visibility: hidden;
104     }
105
106     a.headerlink:hover {
107       background-color: #c60f0f;
108       color: white;
109     }
110
111     h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
112       visibility: visible;
113     }
114   </style>
115
116   <a>
117     <xsl:attribute name="href">
118       <xsl:text>index.html</xsl:text>
119     </xsl:attribute>
120     <xsl:text>Index </xsl:text>
121   </a>·
122   <a>
123     <xsl:attribute name="href">
124       <xsl:text>systemd.directives.html</xsl:text>
125     </xsl:attribute>
126     <xsl:text>Directives </xsl:text>
127   </a>·
128   <a>
129     <xsl:attribute name="href">
130       <xsl:text>../python-systemd/index.html</xsl:text>
131     </xsl:attribute>
132     <xsl:text>Python </xsl:text>
133   </a>·
134   <a>
135     <xsl:attribute name="href">
136       <xsl:text>../libudev/index.html</xsl:text>
137     </xsl:attribute>
138     <xsl:text>libudev </xsl:text>
139   </a>·
140   <a>
141     <xsl:attribute name="href">
142       <xsl:text>../libudev/index.html</xsl:text>
143     </xsl:attribute>
144     <xsl:text>gudev </xsl:text>
145   </a>
146
147   <span style="float:right">
148     <xsl:text>systemd </xsl:text>
149     <xsl:value-of select="$systemd.version"/>
150   </span>
151   <hr/>
152 </xsl:template>
153
154 <!-- Switch things to UTF-8, ISO-8859-1 is soo yesteryear -->
155 <xsl:output method="html" encoding="UTF-8" indent="no"/>
156
157 </xsl:stylesheet>