diff mbox series

[RFC,12/12] doc: manpage: remove callout hack

Message ID 20230413115745.116063-13-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
DocBook Stylesheets already have much better support for callouts.

This:

     $ git diff            (1)
     $ git diff --cached   (2)
     $ git diff HEAD       (3)

  1. Changes in the working tree not yet staged for the next
     commit.
  2. Changes between the index and your last commit; what you
     would be committing if you run git commit without -a
     option.
  3. Changes in the working tree since your last commit; what
     you would be committing if you run git commit -a

Looks much better than this:

       $ git diff            (1)
       $ git diff --cached   (2)
       $ git diff HEAD       (3)

   1. Changes in the working tree not yet staged for the next commit.
   2. Changes between the index and your last commit; what you would
   be committing if you run git commit without -a option.
   3. Changes in the working tree since your last commit; what you
   would be committing if you run git commit -a

This implementation goes back to 2006: 776e994af5 (Properly render
asciidoc "callouts" in git man pages., 2006-04-28). It probably wasn't
needed since a long time ago.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Documentation/gen-stylesheet | 17 -----------------
 t/t0600-doc-tools.sh         | 24 +++++++++++++++---------
 2 files changed, 15 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/gen-stylesheet b/Documentation/gen-stylesheet
index 7d1839fcab..53c3dfca17 100755
--- a/Documentation/gen-stylesheet
+++ b/Documentation/gen-stylesheet
@@ -12,23 +12,6 @@  cat <<EOF
 <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
diff --git a/t/t0600-doc-tools.sh b/t/t0600-doc-tools.sh
index 545fb0e199..10a472e1e6 100755
--- a/t/t0600-doc-tools.sh
+++ b/t/t0600-doc-tools.sh
@@ -74,13 +74,19 @@  $ git diff @ \fB(3)\fR
 .RE
 .\}
 .sp
-.sp
-\fB1. \fRCallout 1
-.br
-\fB2. \fRCallout 2
-.br
-\fB3. \fRCallout 3
-.br
+.TS
+tab(:);
+r lw(\n(.lu*75u/100u).
+\fB1.\fR\h'-2n':T{
+Callout 1
+T}
+\fB2.\fR\h'-2n':T{
+Callout 2
+T}
+\fB3.\fR\h'-2n':T{
+Callout 3
+T}
+.TE
 .SH "GIT"
 .sp
 Part of the \fBgit\fR(1) suite
@@ -116,12 +122,12 @@  test_expect_success ASCIIDOC 'legacy asciidoc.py' '
 	check_manpage "git-foo"
 '
 
-test_expect_failure ASCIIDOC 'legacy asciidoc.py (docbook5)' '
+test_expect_success ASCIIDOC 'legacy asciidoc.py (docbook5)' '
 	build_asciidoc_py "git-foo" docbook5 &&
 	check_manpage "git-foo"
 '
 
-test_expect_failure ASCIIDOCTOR 'modern asciidoctor (docbook5)' '
+test_expect_success ASCIIDOCTOR 'modern asciidoctor (docbook5)' '
 	build_asciidoctor "git-foo" &&
 	check_manpage "git-foo"
 '