76318284fc970b30e9dc4c079960807345331dadLennart Poettering This file is part of systemd.
76318284fc970b30e9dc4c079960807345331dadLennart Poettering Copyright 2011 Lennart Poettering
76318284fc970b30e9dc4c079960807345331dadLennart Poettering systemd is free software; you can redistribute it and/or modify it
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering under the terms of the GNU Lesser General Public License as published by
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
76318284fc970b30e9dc4c079960807345331dadLennart Poettering (at your option) any later version.
76318284fc970b30e9dc4c079960807345331dadLennart Poettering systemd is distributed in the hope that it will be useful, but
76318284fc970b30e9dc4c079960807345331dadLennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
76318284fc970b30e9dc4c079960807345331dadLennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering Lesser General Public License for more details.
5430f7f2bc7330f3088b894166bf3524a067e3d8Lennart Poettering You should have received a copy of the GNU Lesser General Public License
76318284fc970b30e9dc4c079960807345331dadLennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
76318284fc970b30e9dc4c079960807345331dadLennart Poettering<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
76318284fc970b30e9dc4c079960807345331dadLennart Poettering<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - The docbook stylesheet injects empty anchor tags into generated HTML, identified by an auto-generated ID.
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - Ask the docbook stylesheet to generate reproducible output when generating (these) ID values.
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - This makes the output of this stylesheet reproducible across identical invocations on the same input,
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - which is an easy and significant win for achieving reproducible builds.
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - It may be even better to strip the empty anchors from the document output in addition to turning on consistent IDs,
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk - for this stylesheet contains its own custom ID logic (for generating permalinks) already.
d77c25b1164f55fe3f9b5ad00c47c0e01243ad53Johan Ouwerkerk<xsl:param name="generate.consistent.ids" select="1"/>
ecca17f6eec83b58f39ff5dc7894044c524ddf41Kay Sievers<!-- translate man page references to links to html pages -->
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[not(@project)]">
958caa58c089037ffb8cd71bc342bb9d798a6dd3Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/><xsl:text>.html#</xsl:text>
958caa58c089037ffb8cd71bc342bb9d798a6dd3Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle/@target"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='man-pages'] | citerefentry[manvolnum='2'] | citerefentry[manvolnum='4']">
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:text>http://man7.org/linux/man-pages/man</xsl:text>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='die-net']">
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:text>http://linux.die.net/man/</xsl:text>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
74a6d87d0cd1f2213869e168b6ca55eded6f4ae8Zbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='mankier']">
74a6d87d0cd1f2213869e168b6ca55eded6f4ae8Zbigniew Jędrzejewski-Szmek <xsl:text>https://www.mankier.com/</xsl:text>
74a6d87d0cd1f2213869e168b6ca55eded6f4ae8Zbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
74a6d87d0cd1f2213869e168b6ca55eded6f4ae8Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
74a6d87d0cd1f2213869e168b6ca55eded6f4ae8Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='archlinux']">
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:text>https://www.archlinux.org/</xsl:text>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
5aded369782f28255bc6b494ca905d7acaea7a56Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
b5c7d097ec7d16facaaeb0da5ba2abb2b1fc230bZbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='freebsd']">
b5c7d097ec7d16facaaeb0da5ba2abb2b1fc230bZbigniew Jędrzejewski-Szmek <xsl:text>https://www.freebsd.org/cgi/man.cgi?</xsl:text>
b5c7d097ec7d16facaaeb0da5ba2abb2b1fc230bZbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
b5c7d097ec7d16facaaeb0da5ba2abb2b1fc230bZbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
b5c7d097ec7d16facaaeb0da5ba2abb2b1fc230bZbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
3b5cfcdb580f5b766ff7fb1a2839bd37d74a98deZbigniew Jędrzejewski-Szmek<xsl:template match="citerefentry[@project='dbus']">
3b5cfcdb580f5b766ff7fb1a2839bd37d74a98deZbigniew Jędrzejewski-Szmek <xsl:text>http://dbus.freedesktop.org/doc/</xsl:text>
3b5cfcdb580f5b766ff7fb1a2839bd37d74a98deZbigniew Jędrzejewski-Szmek <xsl:value-of select="refentrytitle"/>
3b5cfcdb580f5b766ff7fb1a2839bd37d74a98deZbigniew Jędrzejewski-Szmek <xsl:value-of select="manvolnum"/>
3b5cfcdb580f5b766ff7fb1a2839bd37d74a98deZbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - helper template to do conflict resolution between various headings with the same inferred ID attribute/tag from the headerlink template
a8eaaee72a2f06e0fb64fb71de3b71ecba31dafbJan Engelhardt - this conflict resolution is necessary to prevent malformed HTML output (multiple ID attributes with the same value)
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - and it fixes xsltproc warnings during compilation of HTML man pages
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - A simple top-to-bottom numbering scheme is implemented for nodes with the same ID value to derive unique ID values for HTML output.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - It uses two parameters:
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk templateID the proposed ID string to use which must be checked for conflicts
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk keyNode the context node which 'produced' the given templateID.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - Conflicts are detected solely based on keyNode, templateID is not taken into account for that purpose.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <!-- node which generatedID needs to assume as the 'source' of the ID -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <!-- suggested value for generatedID output, a contextually meaningful ID string -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:variable name="conflictSource" select="preceding::refsect1/title|preceding::refsect1/info/title|
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk preceding::refsect2/title|preceding::refsect2/info/title|
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk preceding::varlistentry/term[1]"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:variable name="conflictCount" select="count($conflictSource[. = $keyNode])"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <!-- special case conflictCount = 0 to preserve compatibility with URLs generated by previous versions of this XSL stylesheet where possible -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:value-of select="concat($templateID, $conflictCount)"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - a helper template to abstract over the structure of generated subheading + permalink HTML output
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - It helps reduce tedious repetition and groups all actual markup output (as opposed to URL/ID logic) in a single location.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:param name="nodeType"/> <!-- local name of the element node to generate, e.g. 'h2' for <h2></h2> -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:param name="nodeContent"/> <!-- nodeset to apply further templates to obtain the content of the subheading/term -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:param name="linkTitle"/> <!-- value for title attribute of generated permalink, e.g. 'this is a permalink' -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <!-- parameters passed to generateID template, otherwise unused. -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - If stable URLs with fragment markers (references to the ID) turn out not to be important:
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - generatedID could simply take the value of generate-id(), and various other helper templates may be dropped entirely.
b938cb902c3b5bca807a94b277672c64d6767886Jan Engelhardt - Alternatively, if xsltproc is patched to generate reproducible generate-id() output, the same simplifications can be
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - applied at the cost of breaking compatibility with URLs generated from output of previous versions of this stylesheet.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="keyNode" select="$keyNode"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="templateID" select="$templateID"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:apply-templates select="$nodeContent"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <a class="headerlink" title="{$linkTitle}" href="#{$generatedID}">¶</a>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk<!-- simple wrapper around permalink to avoid repeating common info for each level of subheading covered by the permalink logic (h2, h3) -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeType" select="$nodeType"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="linkTitle" select="'Permalink to this headline'"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeContent" select="node()"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - To retain compatibility with IDs generated by previous versions of the template, inline.charseq must be called.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - The purpose of that template is to generate markup (according to docbook documentation its purpose is to mark/format something as plain text).
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - The only reason to call this template is to get the auto-generated text such as brackets ([]) before flattening it.
fa13e4a78487971a5093db3fdc61cad224d47c16Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk<xsl:template match="refsect1/title|refsect1/info/title">
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <!-- the ID is output in the block.object call for refsect1 -->
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeType" select="'h2'"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk<xsl:template match="refsect2/title|refsect2/info/title">
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeType" select="'h3'"/>
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek<xsl:template match="varlistentry">
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeType" select="'dt'"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="linkTitle" select="'Permalink to this term'"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="nodeContent" select="term"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="keyNode" select="term[1]"/>
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - To retain compatibility with IDs generated by previous versions of the template, inline.charseq must be called.
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - The purpose of that template is to generate markup (according to docbook documentation its purpose is to mark/format something as plain text).
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk - The only reason to call this template is to get the auto-generated text such as brackets ([]) before flattening it.
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.charseq">
aa1169774bbd61761965d826fe36bd071ec78656Johan Ouwerkerk <xsl:with-param name="content" select="term[1]"/>
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek <xsl:apply-templates select="listitem"/>
ecca17f6eec83b58f39ff5dc7894044c524ddf41Kay Sievers<!-- add Index link at top of page -->
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek font-size: 0.8em;
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek padding: 0 4px 0 4px;
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek text-decoration: none;
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek visibility: hidden;
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek background-color: #c60f0f;
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
20089f95e83dd6a3e9238b3448ce2e55536184ffZbigniew Jędrzejewski-Szmek visibility: visible;
2cc8d9731aff3e401bc6a5a243f20fec123d48e6Zbigniew Jędrzejewski-Szmek <xsl:text>systemd.directives.html</xsl:text>
2cc8d9731aff3e401bc6a5a243f20fec123d48e6Zbigniew Jędrzejewski-Szmek <xsl:text>Directives </xsl:text>
702f64b93cb215d43f673dd4b2f3646b879c566eZbigniew Jędrzejewski-Szmek <xsl:value-of select="$systemd.version"/>
909f413d3c572baadf9b13e36e1e90beba42af86Zbigniew Jędrzejewski-Szmek <xsl:call-template name="inline.monoseq"/>
76318284fc970b30e9dc4c079960807345331dadLennart Poettering<!-- Switch things to UTF-8, ISO-8859-1 is soo yesteryear -->
76318284fc970b30e9dc4c079960807345331dadLennart Poettering<xsl:output method="html" encoding="UTF-8" indent="no"/>