man: Use custom XSL stylesheet for HTML output
authorDan Nicholson <dbn@endlessos.org>
Fri, 8 Apr 2022 21:30:23 +0000 (15:30 -0600)
committerDan Nicholson <dbn@endlessos.org>
Sat, 9 Apr 2022 01:25:32 +0000 (19:25 -0600)
This allows using a template stolen from systemd to turn references into
links.

Makefile-man.am
man/html.xsl [new file with mode: 0644]

index 1779edc12ee243ea10c2ada5c519884c9e871248..3f941bed4f93ef9cccbbde1d8b071423449212df 100644 (file)
@@ -68,7 +68,8 @@ endif
 EXTRA_DIST += $(man1_MANS:.1=.xml) $(man5_MANS:.5=.xml)
 
 XSLT_MAN_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
-XSLT_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
+XSLT_HTML_STYLESHEET = man/html.xsl
+EXTRA_DIST += $(XSLT_HTML_STYLESHEET)
 
 XSLTPROC_FLAGS = \
         --nonet \
diff --git a/man/html.xsl b/man/html.xsl
new file mode 100644 (file)
index 0000000..17a425d
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+
+<!--
+Copyright © 2022 Endless OS Foundation LLC
+
+SPDX-License-Identifier: LGPL-2.0+
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library. If not, see <https://www.gnu.org/licenses/>.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
+
+<!-- translate man page references to links to html pages -->
+<xsl:template match="citerefentry">
+  <a>
+    <xsl:attribute name="href">
+      <xsl:value-of select="refentrytitle"/>
+      <xsl:text>.html</xsl:text>
+    </xsl:attribute>
+    <xsl:call-template name="inline.charseq"/>
+  </a>
+</xsl:template>
+
+</xsl:stylesheet>