Lennart Poettering | 7631828 | 2011-12-19 20:25:52 +0100 | [diff] [blame] | 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 |
Lennart Poettering | 5430f7f | 2012-04-12 00:20:58 +0200 | [diff] [blame] | 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 |
Lennart Poettering | 7631828 | 2011-12-19 20:25:52 +0100 | [diff] [blame] | 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 |
Lennart Poettering | 5430f7f | 2012-04-12 00:20:58 +0200 | [diff] [blame] | 16 | Lesser General Public License for more details. |
Lennart Poettering | 7631828 | 2011-12-19 20:25:52 +0100 | [diff] [blame] | 17 | |
Lennart Poettering | 5430f7f | 2012-04-12 00:20:58 +0200 | [diff] [blame] | 18 | You should have received a copy of the GNU Lesser General Public License |
Lennart Poettering | 7631828 | 2011-12-19 20:25:52 +0100 | [diff] [blame] | 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 | |
Kay Sievers | ecca17f | 2012-07-17 23:04:48 +0200 | [diff] [blame] | 26 | <!-- translate man page references to links to html pages --> |
Zbigniew Jędrzejewski-Szmek | 5aded36 | 2014-07-07 18:25:54 -0400 | [diff] [blame] | 27 | <xsl:template match="citerefentry[not(@project)]"> |
Kay Sievers | ecca17f | 2012-07-17 23:04:48 +0200 | [diff] [blame] | 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 | |
Zbigniew Jędrzejewski-Szmek | 5aded36 | 2014-07-07 18:25:54 -0400 | [diff] [blame] | 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 | |
Zbigniew Jędrzejewski-Szmek | 74a6d87 | 2015-02-01 16:05:56 -0500 | [diff] [blame] | 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 | |
Zbigniew Jędrzejewski-Szmek | 5aded36 | 2014-07-07 18:25:54 -0400 | [diff] [blame] | 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 | |
Zbigniew Jędrzejewski-Szmek | b5c7d09 | 2015-03-13 21:23:24 -0500 | [diff] [blame] | 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 | |
Zbigniew Jędrzejewski-Szmek | 3b5cfcd | 2015-03-13 21:24:30 -0500 | [diff] [blame] | 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 | |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 116 | <!-- |
| 117 | - helper template to do conflict resolution between various headings with the same inferred ID attribute/tag from the headerlink template |
| 118 | - this conflict resolution is necessary to prevent malformed HTML ouput (multiple id attributes with the same value) |
| 119 | - and it fixes xsltproc warnings during compilation of HTML man pages |
| 120 | - |
| 121 | - A simple top-to-bottom numbering scheme is implemented for nodes with the same ID value to derive unique ID values for HTML output. |
| 122 | - It uses two parameters: |
| 123 | templateID the proposed ID string to use which must be checked for conflicts |
| 124 | keyNode the context node which 'produced' the given templateID. |
| 125 | - |
| 126 | - Conflicts are detected solely based on keyNode, templateID is not taken into account for that purpose. |
| 127 | --> |
| 128 | <xsl:template name="generateID"> |
| 129 | <!-- node which generatedID needs to assume as the 'source' of the ID --> |
| 130 | <xsl:param name="keyNode"/> |
| 131 | <!-- suggested value for generatedID output, a contextually meaningful ID string --> |
| 132 | <xsl:param name="templateID"/> |
| 133 | <xsl:variable name="conflictSource" select="preceding::refsect1/title|preceding::refsect1/info/title| |
| 134 | preceding::refsect2/title|preceding::refsect2/info/title| |
| 135 | preceding::varlistentry/term[1]"/> |
| 136 | <xsl:variable name="conflictCount" select="count($conflictSource[. = $keyNode])"/> |
| 137 | <xsl:choose> |
| 138 | <!-- special case conflictCount = 0 to preserve compatibility with URLs generated by previous versions of this XSL stylesheet where possible --> |
| 139 | <xsl:when test="$conflictCount = 0"> |
| 140 | <xsl:value-of select="$templateID"/> |
| 141 | </xsl:when> |
| 142 | <xsl:otherwise> |
| 143 | <xsl:value-of select="concat($templateID, $conflictCount)"/> |
| 144 | </xsl:otherwise> |
| 145 | </xsl:choose> |
| 146 | </xsl:template> |
| 147 | |
| 148 | <!-- |
| 149 | - a helper template to abstract over the structure of generated subheading + permalink HTML output |
| 150 | - It helps reduce tedious repetition and groups all actual markup output (as opposed to URL/ID logic) in a single location. |
| 151 | --> |
| 152 | <xsl:template name="permalink"> |
| 153 | <xsl:param name="nodeType"/> <!-- local name of the element node to generate, e.g. 'h2' for <h2></h2> --> |
| 154 | <xsl:param name="nodeContent"/> <!-- nodeset to apply further templates to obtain the content of the subheading/term --> |
| 155 | <xsl:param name="linkTitle"/> <!-- value for title attribute of generated permalink, e.g. 'this is a permalink' --> |
| 156 | |
| 157 | <!-- parameters passed to generateID template, otherwise unused. --> |
| 158 | <xsl:param name="keyNode"/> |
| 159 | <xsl:param name="templateID"/> |
| 160 | |
| 161 | <!-- |
| 162 | - If stable URLs with fragment markers (references to the ID) turn out not to be important: |
| 163 | - generatedID could simply take the value of generate-id(), and various other helper templates may be dropped entirely. |
| 164 | - Alternatively if xsltproc is patched to generate reproducible generate-id() output the same simplifications can be |
| 165 | - applied at the cost of breaking compatibility with URLs generated from output of previous versions of this stylesheet. |
| 166 | --> |
| 167 | <xsl:variable name="generatedID"> |
| 168 | <xsl:call-template name="generateID"> |
| 169 | <xsl:with-param name="keyNode" select="$keyNode"/> |
| 170 | <xsl:with-param name="templateID" select="$templateID"/> |
| 171 | </xsl:call-template> |
| 172 | </xsl:variable> |
| 173 | |
| 174 | <xsl:element name="{$nodeType}"> |
| 175 | <xsl:attribute name="id"> |
| 176 | <xsl:value-of select="$generatedID"/> |
| 177 | </xsl:attribute> |
| 178 | <xsl:apply-templates select="$nodeContent"/> |
| 179 | <a class="headerlink" title="{$linkTitle}" href="#{$generatedID}">¶</a> |
| 180 | </xsl:element> |
| 181 | </xsl:template> |
| 182 | |
| 183 | <!-- simple wrapper around permalink to avoid repeating common info for each level of subheading covered by the permalink logic (h2, h3) --> |
| 184 | <xsl:template name="headerlink"> |
| 185 | <xsl:param name="nodeType"/> |
| 186 | <xsl:call-template name="permalink"> |
| 187 | <xsl:with-param name="nodeType" select="$nodeType"/> |
| 188 | <xsl:with-param name="linkTitle" select="'Permalink to this headline'"/> |
| 189 | <xsl:with-param name="nodeContent" select="node()"/> |
| 190 | <xsl:with-param name="keyNode" select="."/> |
| 191 | <!-- |
| 192 | - To retain compatibility with IDs generated by previous versions of the template, inline.charseq must be called. |
| 193 | - The purpose of that template is to generate markup (according to docbook documentation its purpose is to mark/format something as plain text). |
| 194 | - The only reason to call this template is to get the auto-generated text such as brackets ([]) before flattening it. |
| 195 | --> |
| 196 | <xsl:with-param name="templateID"> |
| 197 | <xsl:call-template name="inline.charseq"/> |
| 198 | </xsl:with-param> |
| 199 | </xsl:call-template> |
| 200 | </xsl:template> |
| 201 | |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 202 | <xsl:template match="refsect1/title|refsect1/info/title"> |
| 203 | <!-- the ID is output in the block.object call for refsect1 --> |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 204 | <xsl:call-template name="headerlink"> |
| 205 | <xsl:with-param name="nodeType" select="'h2'"/> |
| 206 | </xsl:call-template> |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 207 | </xsl:template> |
| 208 | |
Zbigniew Jędrzejewski-Szmek | fa13e4a | 2013-05-06 20:00:16 -0400 | [diff] [blame] | 209 | <xsl:template match="refsect2/title|refsect2/info/title"> |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 210 | <xsl:call-template name="headerlink"> |
| 211 | <xsl:with-param name="nodeType" select="'h3'"/> |
| 212 | </xsl:call-template> |
Zbigniew Jędrzejewski-Szmek | fa13e4a | 2013-05-06 20:00:16 -0400 | [diff] [blame] | 213 | </xsl:template> |
| 214 | |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 215 | <xsl:template match="varlistentry"> |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 216 | <xsl:call-template name="permalink"> |
| 217 | <xsl:with-param name="nodeType" select="'dt'"/> |
| 218 | <xsl:with-param name="linkTitle" select="'Permalink to this term'"/> |
| 219 | <xsl:with-param name="nodeContent" select="term"/> |
| 220 | <xsl:with-param name="keyNode" select="term[1]"/> |
| 221 | <!-- |
| 222 | - To retain compatibility with IDs generated by previous versions of the template, inline.charseq must be called. |
| 223 | - The purpose of that template is to generate markup (according to docbook documentation its purpose is to mark/format something as plain text). |
| 224 | - The only reason to call this template is to get the auto-generated text such as brackets ([]) before flattening it. |
| 225 | --> |
| 226 | <xsl:with-param name="templateID"> |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 227 | <xsl:call-template name="inline.charseq"> |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 228 | <xsl:with-param name="content" select="term[1]"/> |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 229 | </xsl:call-template> |
Johan Ouwerkerk | aa11697 | 2015-07-12 03:07:24 +0200 | [diff] [blame^] | 230 | </xsl:with-param> |
| 231 | </xsl:call-template> |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 232 | <dd> |
| 233 | <xsl:apply-templates select="listitem"/> |
| 234 | </dd> |
| 235 | </xsl:template> |
| 236 | |
| 237 | |
Kay Sievers | ecca17f | 2012-07-17 23:04:48 +0200 | [diff] [blame] | 238 | <!-- add Index link at top of page --> |
| 239 | <xsl:template name="user.header.content"> |
Zbigniew Jędrzejewski-Szmek | 20089f9 | 2013-05-03 20:25:57 -0400 | [diff] [blame] | 240 | <style> |
| 241 | a.headerlink { |
| 242 | color: #c60f0f; |
| 243 | font-size: 0.8em; |
| 244 | padding: 0 4px 0 4px; |
| 245 | text-decoration: none; |
| 246 | visibility: hidden; |
| 247 | } |
| 248 | |
| 249 | a.headerlink:hover { |
| 250 | background-color: #c60f0f; |
| 251 | color: white; |
| 252 | } |
| 253 | |
| 254 | h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink { |
| 255 | visibility: visible; |
| 256 | } |
| 257 | </style> |
| 258 | |
Kay Sievers | ecca17f | 2012-07-17 23:04:48 +0200 | [diff] [blame] | 259 | <a> |
| 260 | <xsl:attribute name="href"> |
| 261 | <xsl:text>index.html</xsl:text> |
| 262 | </xsl:attribute> |
| 263 | <xsl:text>Index </xsl:text> |
Zbigniew Jędrzejewski-Szmek | 2cc8d97 | 2013-03-07 13:13:44 -0500 | [diff] [blame] | 264 | </a>· |
| 265 | <a> |
| 266 | <xsl:attribute name="href"> |
| 267 | <xsl:text>systemd.directives.html</xsl:text> |
| 268 | </xsl:attribute> |
| 269 | <xsl:text>Directives </xsl:text> |
Kay Sievers | 1f35347 | 2015-06-22 19:54:52 +0200 | [diff] [blame] | 270 | </a> |
Zbigniew Jędrzejewski-Szmek | 702f64b | 2013-03-12 23:57:09 -0400 | [diff] [blame] | 271 | |
| 272 | <span style="float:right"> |
| 273 | <xsl:text>systemd </xsl:text> |
| 274 | <xsl:value-of select="$systemd.version"/> |
| 275 | </span> |
Kay Sievers | ecca17f | 2012-07-17 23:04:48 +0200 | [diff] [blame] | 276 | <hr/> |
| 277 | </xsl:template> |
| 278 | |
Zbigniew Jędrzejewski-Szmek | 909f413 | 2013-06-26 08:03:53 -0400 | [diff] [blame] | 279 | <xsl:template match="literal"> |
| 280 | <xsl:text>"</xsl:text> |
| 281 | <xsl:call-template name="inline.monoseq"/> |
| 282 | <xsl:text>"</xsl:text> |
| 283 | </xsl:template> |
| 284 | |
Lennart Poettering | 7631828 | 2011-12-19 20:25:52 +0100 | [diff] [blame] | 285 | <!-- Switch things to UTF-8, ISO-8859-1 is soo yesteryear --> |
| 286 | <xsl:output method="html" encoding="UTF-8" indent="no"/> |
| 287 | |
| 288 | </xsl:stylesheet> |