diff mbox series

[RFC,10/12] doc: stylesheet: move all the xslt templates

Message ID 20230413115745.116063-11-felipe.contreras@gmail.com (mailing list archive)
State New, archived
Headers show
Series doc: add tests and reimplement xmlto | expand

Commit Message

Felipe Contreras April 13, 2023, 11:57 a.m. UTC
There's no need to have them scattered everywhere.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/gen-stylesheet           | 42 +++++++++++++++++++++-----
 Documentation/manpage-bold-literal.xsl | 16 ----------
 Documentation/manpage-normal.xsl       | 26 ----------------
 3 files changed, 35 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/manpage-bold-literal.xsl
 delete mode 100644 Documentation/manpage-normal.xsl
diff mbox series

Patch

diff --git a/Documentation/gen-stylesheet b/Documentation/gen-stylesheet
index c006a85c39..7d1839fcab 100755
--- a/Documentation/gen-stylesheet
+++ b/Documentation/gen-stylesheet
@@ -1,17 +1,45 @@ 
 #!/bin/sh
 
-includes='manpage-normal.xsl'
-test -z "$NO_MAN_BOLD_LITERAL" && includes="$includes manpage-bold-literal.xsl"
-
 cat <<EOF
 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
 EOF
 
-for x in $includes
-do
-	printf '<xsl:include href="%s"/>\n' "$x"
-done
+# these params silence some output from xsltproc
+cat <<EOF
+<xsl:param name="man.output.quietly" select="1"/>
+<xsl:param name="refentry.meta.get.quietly" select="1"/>
+EOF
+
+# convert asciidoc callouts to man page format
+cat <<EOF
+<xsl:template match="co">
+	<xsl:value-of select="concat('\fB(',substring-after(@id,'-'),')\fR')"/>
+</xsl:template>
+<xsl:template match="calloutlist">
+	<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:text>.br&#10;</xsl:text>
+</xsl:template>
+EOF
+
+if [[ -z "$NO_MAN_BOLD_LITERAL" ]]
+then
+	# render literal text as bold (instead of plain or monospace); this makes
+	# literal text easier to distinguish in manpages viewed on a tty
+	cat <<-EOF
+	<xsl:template match="literal">
+		<xsl:text>\fB</xsl:text>
+		<xsl:apply-templates/>
+		<xsl:text>\fR</xsl:text>
+	</xsl:template>
+	EOF
+fi
 
 echo "</xsl:stylesheet>"
diff --git a/Documentation/manpage-bold-literal.xsl b/Documentation/manpage-bold-literal.xsl
deleted file mode 100644
index e13db85693..0000000000
--- a/Documentation/manpage-bold-literal.xsl
+++ /dev/null
@@ -1,16 +0,0 @@ 
-<!-- manpage-bold-literal.xsl:
-     special formatting for manpages rendered from asciidoc+docbook -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		xmlns:d="http://docbook.org/ns/docbook"
-		version="1.0">
-
-<!-- render literal text as bold (instead of plain or monospace);
-     this makes literal text easier to distinguish in manpages
-     viewed on a tty -->
-<xsl:template match="literal|d:literal">
-	<xsl:text>\fB</xsl:text>
-	<xsl:apply-templates/>
-	<xsl:text>\fR</xsl:text>
-</xsl:template>
-
-</xsl:stylesheet>
diff --git a/Documentation/manpage-normal.xsl b/Documentation/manpage-normal.xsl
deleted file mode 100644
index 3fb044a8a7..0000000000
--- a/Documentation/manpage-normal.xsl
+++ /dev/null
@@ -1,26 +0,0 @@ 
-<!-- manpage-normal.xsl:
-     special settings for manpages rendered from asciidoc+docbook -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-		version="1.0">
-
-
-<!-- these params silence some output from xsltproc -->
-<xsl:param name="man.output.quietly" select="1"/>
-<xsl:param name="refentry.meta.get.quietly" select="1"/>
-
-<!-- convert asciidoc callouts to man page format -->
-<xsl:template match="co">
-	<xsl:value-of select="concat('\fB(',substring-after(@id,'-'),')\fR')"/>
-</xsl:template>
-<xsl:template match="calloutlist">
-	<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:text>.br&#10;</xsl:text>
-</xsl:template>
-
-</xsl:stylesheet>