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

Re: [PATCH] Documentation: fix build with Asciidoctor 2

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Sep 8, 2019, 22:24 UTC
Message-ID
<20190908222423.GN11334@genre.crustytoothpaste.net>
In-Reply-To
<20190908212122.GA8514@sigill.intra.peff.net>
On 2019-09-08 at 21:21:22, Jeff King wrote:
Show 13 quoted lines
> But it's not clear from that whether asciidoc's docbook5 backend inserts
> an extra newline, or if it's part of the xml translation. Looking at the
> actual XML, I see:
> 
>   <listitem>
>   <simpara>hand resolve the conflict in the working directory, and update
>   the index file to bring it into a state that the patch should
>   have produced.  Then run the command with the <literal>--continue</literal> option.</simpara>
>   </listitem>
> 
> which looks OK. I wondered if there should not be a break between
> <listitem> and <simpara>, but it's there in the asciidoc version, too.
> So I'm inclined to blame xmlto/docbook5 here.

Trying again, I'm able to reproduce this. I found the cause, which is in the stylesheets. XSLT stylesheets have the ability to specify elements from which whitespace should be stripped (using the xsl:strip-space directive). In the DocBook stylesheets, listitem is specified as such an element, so the whitespace there should be stripped.

However, in DocBook 5, our elements are in a namespace. Therefore, the unnamespaced stylesheets specify only "listitem", not "d:listitem", like the namespaced stylesheets do. Because this happens right after the tree has been constructed "but before it is otherwise processed by XSLT" and isn't affected by the EXSLT extension that allows re-parsing the modified tree, then we end up with the whitespace that we don't want.

There are a couple ways around this.
1. We can force xmlto to use the DocBook 5 stylesheets with the "-x"
flag, but we have to know where they are.  Debian and Fedora have them
in different places, so we'd need a knob to figure out where they are.
2. We can force xmlto to use a custom stylesheet with "-x" that merely
imports the DocBook 5 stylesheets using a URL.  If the user has the
DocBook 5 stylesheets installed and XML catalogs configured (the default
on Linux distributions), then everything will just work and the system
will resolve it to the local copy.  If, however, things are not properly
configured, this will result in multiple network downloads for each
manual page.
3. We can give up on xmlto and do things ourselves.  This has the same
problem as option 1, since we need to learn how to find the stylesheets.
4. We can send a patch to xmlto to make it use the proper stylesheets
for DocBook 5 and hope upstream does a release and everyone upgrades
shortly.  Since xmlto is not at all active upstream, this seems like it
may be an imprudent choice.
5. We can send a patch to the DocBook stylesheets and have them include
both the namespaced and unnamespaced versions of the element names in
both sets of stylesheets and hope everyone upgrades.

My personal preference is #2; I think that seems like the best choice forward. XML catalogs are well understood and well configured on Linux distributions. Homebrew supports them adequately, but you have to add an environment variable to your shell configuration to enable them. Of course, if you're doing _anything_ with XML, you'll have them enabled.

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Previous: Jeff KingNext: Junio C Hamano
Message 43 of 71 in “asciidoctor-extensions: provide `<refmiscinfo/>`”
  1. asciidoctor-extensions: provide `<refmiscinfo/>`Martin Ågren, Mar 17, 2019
  2. Todd ZullingerMar 17, 2019
  3. Martin ÅgrenMar 17, 2019
  4. Martin ÅgrenMar 19, 2019
  5. Todd ZullingerMar 20, 2019
  6. Martin ÅgrenMar 22, 2019
  7. Todd ZullingerMar 23, 2019
  8. Jeff KingMar 24, 2019
  9. Todd ZullingerMar 24, 2019
  10. Jeff KingMar 25, 2019
  11. Todd ZullingerMar 25, 2019
  12. Todd ZullingerMar 27, 2019
  13. SZEDER GáborMar 27, 2019
  14. brian m. carlsonMar 28, 2019
  15. Todd ZullingerMar 30, 2019
  16. brian m. carlsonMar 30, 2019
  17. Todd ZullingerApr 5, 2019
  18. Jeff KingApr 5, 2019
  19. Jeff KingMar 28, 2019
  20. Jeff KingMar 28, 2019
  21. Jeff KingMar 19, 2019
  22. Jeff KingMar 19, 2019
  23. Junio C HamanoMar 19, 2019
  24. Martin ÅgrenMar 19, 2019
  25. Martin ÅgrenMar 19, 2019
  26. 0/2 asciidoctor-extensions: provide `<refmiscinfo/>`Martin Ågren, Sep 3, 2019
  27. 1/2 asciidoctor-extensions: provide `<refmiscinfo/>`Martin Ågren, Sep 3, 2019
  28. 2/2 doc-diff: replace --cut-header-footer with --cut-footerMartin Ågren, Sep 3, 2019
  29. brian m. carlsonSep 3, 2019
  30. Martin ÅgrenSep 5, 2019
  31. Jeff KingSep 4, 2019
  32. Martin ÅgrenSep 5, 2019
  33. Jeff KingSep 7, 2019
  34. Martin ÅgrenSep 7, 2019
  35. Jeff KingSep 8, 2019
  36. brian m. carlsonSep 6, 2019
  37. Jeff KingSep 7, 2019
  38. brian m. carlsonSep 7, 2019
  39. Documentation: fix build with Asciidoctor 2brian m. carlson, Sep 7, 2019
  40. Jeff KingSep 8, 2019
  41. brian m. carlsonSep 8, 2019
  42. Jeff KingSep 8, 2019
  43. brian m. carlsonSep 8, 2019
  44. Junio C HamanoSep 9, 2019
  45. Jeff KingSep 10, 2019
  46. brian m. carlsonSep 11, 2019
  47. SZEDER GáborSep 8, 2019
  48. Jeff KingSep 8, 2019
  49. Documentation: fix build with Asciidoctor 2brian m. carlson, Sep 13, 2019
  50. Jeff KingSep 13, 2019
  51. Junio C HamanoSep 13, 2019
  52. Martin ÅgrenSep 16, 2019
  53. Junio C HamanoSep 16, 2019
  54. SZEDER GáborSep 14, 2019
  55. brian m. carlsonSep 14, 2019
  56. Documentation: fix build with Asciidoctor 2brian m. carlson, Sep 14, 2019
  57. SZEDER GáborSep 15, 2019
  58. brian m. carlsonSep 15, 2019
  59. SZEDER GáborSep 15, 2019
  60. brian m. carlsonSep 15, 2019
  61. Martin ÅgrenSep 16, 2019
  62. Documentation: fix build with Asciidoctor 2brian m. carlson, Sep 15, 2019
  63. 0/3 asciidoctor-extensions: provide `<refmiscinfo/>`Martin Ågren, Sep 16, 2019
  64. 1/3 Doc/Makefile: give mansource/-version/-manual attributesMartin Ågren, Sep 16, 2019
  65. 2/3 asciidoctor-extensions: provide `<refmiscinfo/>`Martin Ågren, Sep 16, 2019
  66. 3/3 doc-diff: replace --cut-header-footer with --cut-footerMartin Ågren, Sep 16, 2019
  67. Jeff KingMar 19, 2019
  68. Martin ÅgrenMar 19, 2019
  69. Jeff KingMar 19, 2019
  70. Todd ZullingerMar 20, 2019
  71. Martin ÅgrenMar 19, 2019

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.