Fix: doc/man: use a single XSL file and match local names
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 25 Jul 2017 01:36:36 +0000 (21:36 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 28 Jul 2017 17:40:46 +0000 (13:40 -0400)
Matching the local name instead of the full name, that is:

   *[local-name() = 'co']

instead of just `co` matches both the non-namespaced element and
the DocBook-namespaced element whether we're using the DocBook 4.5 or
DocBook 5.0 stylesheets.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
doc/man/Makefile.am
doc/man/manpage.xsl [new file with mode: 0644]
doc/man/xsl/manpage-bold-literal.xsl [deleted file]
doc/man/xsl/manpage-callouts.xsl [deleted file]
doc/man/xsl/manpage-links.xsl [deleted file]
doc/man/xsl/manpage.xsl [deleted file]

index 52bd2688f37a468a69e0b9d037b44856000318ff..eb88e86d8cc8f26d1fa81ce55c5fb970290c8bd2 100644 (file)
@@ -54,12 +54,7 @@ COMMON_TXT = \
 # config
 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
 ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
-XSL_FILES = \
-       manpage.xsl \
-       manpage-callouts.xsl \
-       manpage-bold-literal.xsl \
-       manpage-links.xsl
-XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
+XSL_FILE = $(srcdir)/manpage.xsl
 
 # common dependencies
 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
@@ -121,7 +116,7 @@ xmlto_verbose_0 = @echo "  XMLTO     " $@;
 # tools
 ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
 ADOC_DOCBOOK = $(ADOC) -b docbook
-XTO = $(xmlto_verbose)$(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
+XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man
 
 # only add this dependency if we can build the man pages because it's
 # a file generated by the configure script, so it's more recent than
@@ -132,19 +127,19 @@ COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF)
 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
        $(ADOC_DOCBOOK) -o $@ $<
 
-%.1: %.1.xml $(XSL_SRC_FILES)
+%.1: %.1.xml $(XSL_FILE)
        $(XTO) $< 2>/dev/null
 
 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
        $(ADOC_DOCBOOK) -o $@ $<
 
-%.3: %.3.xml $(XSL_SRC_FILES)
+%.3: %.3.xml $(XSL_FILE)
        $(XTO) $< 2>/dev/null
 
 %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
        $(ADOC_DOCBOOK) -o $@ $<
 
-%.8: %.8.xml $(XSL_SRC_FILES)
+%.8: %.8.xml $(XSL_FILE)
        $(XTO) $< 2>/dev/null
 
 # only clean the generated files if we have the tools to generate them again
@@ -188,7 +183,7 @@ dist-hook:
 endif # !MAN_PAGES_OPT
 
 # always distribute the source files
-EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILES) \
+EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) \
        $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in
 
 # keep generated man pages that can be considered intermediate files
diff --git a/doc/man/manpage.xsl b/doc/man/manpage.xsl
new file mode 100644 (file)
index 0000000..d576e14
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version='1.0'?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <!-- callouts -->
+    <xsl:template match="*[local-name() = 'co']">
+        <xsl:value-of select="concat('\','fB(',substring-after(@id,'-'),')','\','fR')"/>
+    </xsl:template>
+    <xsl:template match="*[local-name() = 'calloutlist']">
+        <xsl:value-of select="."/>
+        <xsl:text>sp&#10;</xsl:text>
+        <xsl:apply-templates/>
+        <xsl:text>&#10;</xsl:text>
+    </xsl:template>
+    <xsl:template match="*[local-name() = 'callout']">
+        <xsl:value-of select="concat('\','fB',substring-after(@arearefs,'-'),'. ','\','fR')"/>
+        <xsl:apply-templates/>
+        <xsl:value-of select="."/>
+        <xsl:text>br&#10;</xsl:text>
+    </xsl:template>
+
+    <!-- links -->
+    <xsl:template match="*[local-name() = 'ulink']">
+        <xsl:apply-templates/><xsl:text> &lt;</xsl:text><xsl:value-of select="@url"/><xsl:text>&gt;</xsl:text>
+    </xsl:template>
+    <xsl:template match="*[local-name() = 'link']">
+        <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
+    </xsl:template>
+
+    <!-- literal -->
+    <xsl:template match="*[local-name() = 'literal']">
+        <xsl:text>\fB</xsl:text>
+        <xsl:value-of select="." />
+        <xsl:text>\fR</xsl:text>
+    </xsl:template>
+
+    <!-- disable end notes -->
+    <xsl:param name="man.endnotes.are.numbered">0</xsl:param>
+</xsl:stylesheet>
diff --git a/doc/man/xsl/manpage-bold-literal.xsl b/doc/man/xsl/manpage-bold-literal.xsl
deleted file mode 100644 (file)
index c0e0900..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-    <xsl:template match="literal">
-        <xsl:text>\fB</xsl:text>
-        <xsl:value-of select="." />
-        <xsl:text>\fR</xsl:text>
-    </xsl:template>
-</xsl:stylesheet>
diff --git a/doc/man/xsl/manpage-callouts.xsl b/doc/man/xsl/manpage-callouts.xsl
deleted file mode 100644 (file)
index 2f7a5d7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-   <xsl:template match="co">
-        <xsl:value-of select="concat('\','fB(',substring-after(@id,'-'),')','\','fR')"/>
-   </xsl:template>
-   <xsl:template match="calloutlist">
-        <xsl:value-of select="."/>
-        <xsl:text>sp&#10;</xsl:text>
-        <xsl:apply-templates/>
-        <xsl:text>&#10;</xsl:text>
-   </xsl:template>
-   <xsl:template match="callout">
-        <xsl:value-of select="concat('\','fB',substring-after(@arearefs,'-'),'. ','\','fR')"/>
-        <xsl:apply-templates/>
-        <xsl:value-of select="."/>
-        <xsl:text>br&#10;</xsl:text>
-   </xsl:template>
-</xsl:stylesheet>
diff --git a/doc/man/xsl/manpage-links.xsl b/doc/man/xsl/manpage-links.xsl
deleted file mode 100644 (file)
index 0662921..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-    <xsl:template match="ulink">
-        <xsl:apply-templates/><xsl:text> &lt;</xsl:text><xsl:value-of select="@url"/><xsl:text>&gt;</xsl:text>
-    </xsl:template>
-    <xsl:template match="link">
-        <xsl:text>\fI</xsl:text><xsl:apply-templates/><xsl:text>\fR</xsl:text>
-    </xsl:template>
-</xsl:stylesheet>
diff --git a/doc/man/xsl/manpage.xsl b/doc/man/xsl/manpage.xsl
deleted file mode 100644 (file)
index b51049f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-    <xsl:import href="manpage-callouts.xsl" />
-    <xsl:import href="manpage-bold-literal.xsl" />
-    <xsl:import href="manpage-links.xsl" />
-
-    <!-- disable end notes -->
-    <xsl:param name="man.endnotes.are.numbered">0</xsl:param>
-</xsl:stylesheet>
This page took 0.028186 seconds and 4 git commands to generate.