Fix: doc/man: use a single XSL file and match local names
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 27 Jul 2017 23:28:40 +0000 (19:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 28 Jul 2017 20:02:50 +0000 (16:02 -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: Mathieu Desnoyers <mathieu.desnoyers@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-headings.xsl [deleted file]
doc/man/xsl/manpage-links.xsl [deleted file]
doc/man/xsl/manpage.xsl [deleted file]

index 3d8ee494045229ebca2784326171e1e67cdc4ecd..fcc4c5c731558e80a5c141fe1ba02827aa5402c4 100644 (file)
@@ -34,13 +34,7 @@ COMMON_TXT = \
 
 # AsciiDoc configuration and XSL files:
 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
-XSL_FILES = \
-       manpage.xsl \
-       manpage-callouts.xsl \
-       manpage-bold-literal.xsl \
-       manpage-links.xsl \
-       manpage-headings.xsl
-XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
+XSL_FILE = $(srcdir)/manpage.xsl
 
 # Common dependencies:
 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
@@ -59,19 +53,19 @@ ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
        -a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@"
 
 ADOC_DOCBOOK = $(ADOC) -b docbook
-XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
+XTO = $(XMLTO) -m $(XSL_FILE) man
 
 # Recipes:
 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
        $(ADOC_DOCBOOK) -o $@ $<
 
-%.1: %.1.xml $(XSL_SRC_FILES)
+%.1: %.1.xml $(XSL_FILE)
        $(XTO) $<
 
 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
        $(ADOC_DOCBOOK) -o $@ $<
 
-%.3: %.3.xml $(XSL_SRC_FILES)
+%.3: %.3.xml $(XSL_FILE)
        $(XTO) $<
 
 # Only clean the generated files if we have the tools to generate them again.
@@ -114,4 +108,4 @@ dist-hook:
 endif # !MAN_PAGES_OPT
 
 # Always distribute the source files.
-EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILES) $(ASCIIDOC_CONF)
+EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF)
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 36dff92..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-       <!-- this template makes the literal elements bold -->
-    <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-headings.xsl b/doc/man/xsl/manpage-headings.xsl
deleted file mode 100644 (file)
index 70e44e1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-       <!-- this template cancels the style of literal elements in title elements -->
-    <xsl:template match="title/literal">
-        <xsl:value-of select="."/>
-    </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 a92e209..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-       <!-- this template appends the URL to the external link text -->
-    <xsl:template match="ulink">
-        <xsl:apply-templates/><xsl:text> &lt;</xsl:text><xsl:value-of select="@url"/><xsl:text>&gt;</xsl:text>
-    </xsl:template>
-
-    <!-- this template emphasizes the internal link text -->
-    <xsl:template match="link">
-        <xsl:text>\fI</xsl:text><xsl:value-of select="."/><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 2c593c4..0000000
+++ /dev/null
@@ -1,9 +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" />
-    <xsl:import href="manpage-headings.xsl" />
-
-    <!-- disable end notes -->
-    <xsl:param name="man.endnotes.are.numbered">0</xsl:param>
-</xsl:stylesheet>
This page took 0.027812 seconds and 4 git commands to generate.