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

Re: quote in help code example

From
Thomas Rast <trast@student.ethz.ch>
Date
Oct 13, 2009, 20:15 UTC
Message-ID
<200910132215.46840.trast@student.ethz.ch>
In-Reply-To
<20091013153031.GX23777@genesis.frugalware.org>
Miklos Vajna wrote:
Show 10 quoted lines
> On Tue, Oct 13, 2009 at 10:06:23PM +0800, bill lam <cbill.lam@gmail.com> wrote:
> > 2. now the .ft pair fixed but it still displayed incorrect quote.
> > 
> >  git filter-branch --tree-filter ´rm filename´ HEAD
> > 
> > it should be 'rm filename' not ´rm filename´
> 
> I can reproduce that here as well, that's how it is in the official
> manpages as well (see the man branch), so that's not specific to your
> system.

Same here. The patch below is a band-aid fix that works for me, but I'd rather have it tested on various docbook/asciidoc combinations if anyone still runs them.

My findings so far were that asciidoc correctly turns the apostrophe into an &apos; entity in the .xml output, and xmlto then turns it into \' instead of just ' in the troff output. Then, if the terminal appears to support Unicode (this can be disabled with LC_ALL=C or such) the formatter turns it into a "real" apostrophe that, of course, is not understood by any ASCII-based tool.

So far so good, and sounded like an easy debugging job, right? Not so. The buzzword-compliance people apparently felt it would be nice to wrap a bad joke of a language in the bad joke of a language that XML already is, and thus was XSL invented. Deep in the horrors of these XSL files, in my case in

  /usr/share/xml/docbook/stylesheet/nwalsh/1.75.2/manpages/other.xsl

there's a template that, according to the comment near it, maltreats our apostrophes:

  * The backslash, dot, dash, and apostrophe (\, ., -, ') characters
  * have special meaning for roff, so before we do any other
  * processing, we must escape those characters where they appear in
  * the source content.

The patch below just replaces said template with a no-op for git's manpage creation. I have not been able to substantiate the claim that apostrophes are special, and in fact with the patch my manpages look fine. Then again I don't know anything about roff syntax either, and manuals seem a bit hard to come by.

Grrr.
diff --git i/Documentation/manpage-base.xsl w/Documentation/manpage-base.xsl
index a264fa6..7c14469 100644
--- i/Documentation/manpage-base.xsl
+++ w/Documentation/manpage-base.xsl
@@ -7,6 +7,11 @@
 <xsl:param name="man.output.quietly" select="1"/>
 <xsl:param name="refentry.meta.get.quietly" select="1"/>
 
+<xsl:template name="escape.apostrophe">
+  <xsl:param name="content"/>
+  <xsl:value-of select="$content"/>
+</xsl:template>
+
 <!-- convert asciidoc callouts to man page format;
      git.docbook.backslash and git.docbook.dot params
      must be supplied by another XSL file or other means -->
-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Previous: Miklos VajnaNext: Thomas Rast
Message 7 of 18 in “quote in help code example”
  1. bill lamOct 12, 2009
  2. Miklos VajnaOct 12, 2009
  3. bill lamOct 13, 2009
  4. Miklos VajnaOct 13, 2009
  5. bill lamOct 13, 2009
  6. Miklos VajnaOct 13, 2009
  7. Thomas RastOct 13, 2009
  8. Thomas RastOct 15, 2009
  9. Quote ' as \(aq in manpagesThomas Rast, Oct 21, 2009
  10. Miklos VajnaOct 21, 2009
  11. Anders KaseorgOct 21, 2009
  12. Quote ' as \(aq in manpagesThomas Rast, Oct 21, 2009
  13. Document GNU_ROFF in MakefileMiklos Vajna, Oct 21, 2009
  14. Junio C HamanoOct 21, 2009
  15. Anders KaseorgOct 21, 2009
  16. Quote ' as \(aq in manpagesThomas Rast, Oct 22, 2009
  17. Anders KaseorgOct 21, 2009
  18. Junio C HamanoOct 12, 2009

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.