All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin Ågren" <martin.agren@gmail.com>
To: git@vger.kernel.org
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Jeff King <peff@peff.net>
Subject: [PATCH] manpage-bold-literal.xsl: provide namespaced template for "d:literal"
Date: Wed, 30 Oct 2019 21:41:04 +0100	[thread overview]
Message-ID: <20191030204104.19603-1-martin.agren@gmail.com> (raw)

We recently regressed our rendering of "literal" elements in our
manpages, i.e, stuff we have placed within `backticks` in order to
render as monospace. In particular, we lost the bold rendering of such
literal text.

The culprit is f6461b82b9 ("Documentation: fix build with Asciidoctor 2",
2019-09-15), where we switched from DocBook 4.5 to DocBook 5 with
Asciidoctor. As part of the switch, we started using the namespaced
DocBook XSLT stylesheets rather than the non-namespaced ones. (See
f6461b82b9 for more details on why we changed to the namespaced ones.)

The bold literals are implemented as an XSLT snippet <xsl:template
match="literal">...</xsl:template>. Now that we use namespaces, this
doesn't pick up our literals like it used to.

Add an exact copy of the template where we match for "d:literal" instead
of just "literal", after defining the d namespace. ("d" is what
http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
uses.) Note that we need to keep the non-namespaced version for
AsciiDoc.

This boldness was introduced by 5121a6d993 ("Documentation: option to
render literal text as bold for manpages", 2009-03-27) and made the
default in 5945717009 ("Documentation: bold literals in man",
2016-05-31).

One reason this was not caught in review is that our doc-diff tool diffs
without any boldness, i.e., it "only" compares text.

This has been optically tested with AsciiDoc 8.6.10, Asciidoctor 1.5.5
and Asciidoctor 2.0.10. I've also verified that doc-diff produces the
empty output in all three cases, as expected.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
---
 I've kept thinking lately that "wow, are we behind on marking up stuff
 to be monospaced/boldened"...

 I'm pretty sure about the background here, but I'm not at all sure 
 that this is the prettiest or correctest fix.
 
 Not sure if this problem is bad enough (and the fix good enough) for
 this to go into 2.24, but I offer this anyway.

 There are more manpage-*.xsl -- manpage-suppress-sp.xsl looks like it
 would have the exact same problem. But before diving in too deep, I'd
 rather submit this one to see if it's in the right direction at all.

 Martin

 Documentation/manpage-bold-literal.xsl | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/manpage-bold-literal.xsl b/Documentation/manpage-bold-literal.xsl
index 608eb5df62..172388d6cf 100644
--- a/Documentation/manpage-bold-literal.xsl
+++ b/Documentation/manpage-bold-literal.xsl
@@ -1,11 +1,20 @@
 <!-- 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="d:literal">
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fB</xsl:text>
+	<xsl:apply-templates/>
+	<xsl:value-of select="$git.docbook.backslash"/>
+	<xsl:text>fR</xsl:text>
+</xsl:template>
+
 <xsl:template match="literal">
 	<xsl:value-of select="$git.docbook.backslash"/>
 	<xsl:text>fB</xsl:text>
-- 
2.24.0.rc2


             reply	other threads:[~2019-10-30 20:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 20:41 Martin Ågren [this message]
2019-10-30 21:24 ` [PATCH] manpage-bold-literal.xsl: provide namespaced template for "d:literal" Jeff King
2019-10-31  6:19   ` Martin Ågren
2019-10-31  2:31 ` brian m. carlson
2019-10-31  6:21   ` Martin Ågren
2019-11-02  5:45     ` Junio C Hamano
2019-10-31  6:22 ` [PATCH v2] manpage-bold-literal.xsl: match for namespaced "d:literal" in template Martin Ågren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191030204104.19603-1-martin.agren@gmail.com \
    --to=martin.agren@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.