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

Re: [PATCH] asciidoctor-extensions: provide `<refmiscinfo/>`

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
Mar 17, 2019, 20:03 UTC
Message-ID
<CAN0heSr3Q48Dfskc7A55Z6MUEk0A3MPQAn3b25+=J1Ezrwk9Hg@mail.gmail.com>
In-Reply-To
<20190317194431.GY31362@pobox.com>
Hi Todd,
On Sun, 17 Mar 2019 at 20:44, Todd Zullinger <tmz@pobox.com> wrote:
Show 103 quoted lines
>
> Hi Martin,
>
> Martin Ågren wrote:
> > That is, we miss out on the `<refmiscinfo/>` tags. As a result, the
> > header of each man page doesn't say "Git Manual", but "git-foo(1)"
> > instead. Worse, the footers don't give the Git version number and
> > instead provide the fairly ugly "[FIXME: source]".
> >
> > That Asciidoctor ignores asciidoc.conf is nothing new. This is why we
> > implement the `linkgit:` macro in asciidoc.conf *and* in
> > asciidoctor-extensions.rb. Follow suit and provide these tags in
> > asciidoctor-extensions.rb, using a "postprocessor" extension.
>
> > We may consider a few alternatives:
> >
> >   * Provide the `mansource` attribute to Asciidoctor. This attribute
> >     looks promising until one realizes that it can only be given inside
> >     the source file (the .txt file in our case), *not* on the command
> >     line using `-a mansource=foobar`. I toyed with the idea of injecting
> >     this attribute while feeding Asciidoctor the input on stdin, but it
> >     didn't feel like it was worth the complexity in the Makefile.
>
> I played with this direction before.  Using Asciidoctor we
> can convert directly from .txt to man without docbook
> and xmlto.  That does have some other issues which need to
> be worked out though.  Here's what I had as a start:
>
> -- 8< --
> Subject: [PATCH] WIP: doc: improve asciidoctor manpage generation
>
> Avoid 'FIXME: Source' by setting mansource.  Skip xmlto step and render
> manpages directly with asciidoctor.
>
> TODO:
>     - apply to all man pages
>     - fix links to html docs, like user-manual.html in git.1 (currently
>       it is listed in brackets inline rather than as a footnote)
>
> Reference:
> https://lore.kernel.org/lkml/20180424150456.17353-1-tiwai@suse.de/
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
>  Documentation/Makefile                  | 8 ++++++++
>  Documentation/asciidoctor-extensions.rb | 2 ++
>  2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/Makefile b/Documentation/Makefile
> index a9697f5146..494f8c9464 100644
> --- a/Documentation/Makefile
> +++ b/Documentation/Makefile
> @@ -197,6 +197,7 @@ ASCIIDOC_DOCBOOK = docbook45
>  ASCIIDOC_EXTRA += -acompat-mode -atabsize=8
>  ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
>  ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
> +ASCIIDOC_EXTRA += -a mansource="Git $(GIT_VERSION)" -a manmanual="Git Manual"
>  DBLATEX_COMMON =
>  endif
>
> @@ -354,9 +355,16 @@ $(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
>  manpage-base-url.xsl: manpage-base-url.xsl.in
>         $(QUIET_GEN)sed "s|@@MAN_BASE_URL@@|$(MAN_BASE_URL)|" $< > $@
>
> +ifndef USE_ASCIIDOCTOR
>  %.1 %.5 %.7 : %.xml manpage-base-url.xsl $(wildcard manpage*.xsl)
>         $(QUIET_XMLTO)$(RM) $@ && \
>         $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
> +else
> +%.1 %.5 %.7 : %.txt
> +       $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
> +       $(ASCIIDOC_COMMON) -b manpage -d manpage -o $@+ $< && \
> +       mv $@+ $@
> +endif
>
>  %.xml : %.txt asciidoc.conf asciidoctor-extensions.rb
>         $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
> diff --git a/Documentation/asciidoctor-extensions.rb b/Documentation/asciidoctor-extensions.rb
> index f7a5982f8b..ebb078807a 100644
> --- a/Documentation/asciidoctor-extensions.rb
> +++ b/Documentation/asciidoctor-extensions.rb
> @@ -12,6 +12,8 @@ module Git
>          if parent.document.basebackend? 'html'
>            prefix = parent.document.attr('git-relative-html-prefix')
>            %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>\n)
> +        elsif parent.document.basebackend? 'manpage'
> +          "#{target}(#{attrs[1]})"
>          elsif parent.document.basebackend? 'docbook'
>            "<citerefentry>\n" \
>              "<refentrytitle>#{target}</refentrytitle>" \
> -- 8< --
>
> That was based on ma/asciidoctor-extensions, but it may be
> missing other recent improvements you've made to the make
> targets.  It's been a month or so since I worked on it.
>
> I munged up doc-diff to set MANDWIDTH=1000 and set one
> branch to default to asciidoctor to compare.  (Your other
> recent series looks like it'll make doing asciidoc and
> asciidoctor comparisons easier.)
>
> There were a number of differences that I didn't work
> through though.  Most importantly was the change in the
> links noted in the commit message.
Your approach looks like the correct one long term, at least.

I'll try to play with this to see if I can figure out the differences. That will have to wait until tomorrow though.

Thanks for sharing your progress.
Martin
Previous: Todd ZullingerNext: Martin Ågren
Message 3 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.