git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 13, 2023, 11:57 UTC
Message-ID
<20230413115745.116063-11-felipe.contreras@gmail.com>
In-Reply-To
<20230413115745.116063-1-felipe.contreras@gmail.com>
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 --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>
-- 
2.40.0+fc1
Previous: Felipe ContrerasNext: Felipe Contreras
Message 11 of 13 in “doc: add tests and reimplement xmlto”
  1. 00/12 doc: add tests and reimplement xmltoFelipe Contreras, Apr 13, 2023
  2. 01/12 doc: add test for doc tools outputFelipe Contreras, Apr 13, 2023
  3. 02/12 doc: add missing manpage docinfoFelipe Contreras, Apr 13, 2023
  4. 03/12 doc: remove unnecessary hack for asciidoctorFelipe Contreras, Apr 13, 2023
  5. 04/12 test: doc: add test for docbook5Felipe Contreras, Apr 13, 2023
  6. 05/12 doc: fix support for multiple docbook backendsFelipe Contreras, Apr 13, 2023
  7. 06/12 doc: add gen-stylesheet helperFelipe Contreras, Apr 13, 2023
  8. 07/12 doc: get rid of xmlto dependencyFelipe Contreras, Apr 13, 2023
  9. 08/12 test: doc: use temporary stylesheetFelipe Contreras, Apr 13, 2023
  10. 09/12 doc: remove references to xmltoFelipe Contreras, Apr 13, 2023
  11. 10/12 doc: stylesheet: move all the xslt templatesFelipe Contreras, Apr 13, 2023
  12. 11/12 test: doc: add check for calloutsFelipe Contreras, Apr 13, 2023
  13. 12/12 doc: manpage: remove callout hackFelipe Contreras, Apr 13, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.