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

Re: [RFC suggestion] Generate manpage directly with Asciidoctor

From
MÅMartin Ågren <martin.agren@gmail.com>
Date
May 9, 2021, 08:29 UTC
Message-ID
<CAN0heSrbJQjzbwm3CiNh7UduKSYKogsHBh6RQszDuk2cGu=r=w@mail.gmail.com>
In-Reply-To
<6095ceb984401_cfc7208b9@natae.notmuch>

On Sat, 8 May 2021 at 01:40, Felipe Contreras <felipe.contreras@gmail.com> wrote:

Show 16 quoted lines
>
> brian m. carlson wrote:
> > On 2021-05-07 at 06:06:31, Bagas Sanjaya wrote:
> > > So completely migrating to Asciidoctor can eliminate xmlto requirement
> > > for generating manpage.
> > >
> > > What do you think about above?
> >
> > I didn't do this because it makes things very complicated in the
> > Makefile and my goal was to minimize the needed changes and divergence.
> > I'm not opposed to someone else doing it, but I expect it will be a
> > bunch of work.
>
> I don't think it would be that complicated.
>
> This patch seems to do the trick here:

This looks similar to Todd's wip [1]. Here's something whitespace-damaged on top that improves some things, but I'm sure there's more to do. I think in order to work on this, it would need to be a separate switch so that we can use asciidoctor both the old-school and the new-school way for a while.

[1] https://lore.kernel.org/git/20190317194431.GY31362@pobox.com/
diff --git a/Documentation/Makefile b/Documentation/Makefile
index 0cfa88a92b..9f73d2d033 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -192,7 +192,9 @@ ASCIIDOC_HTML = xhtml5
 ASCIIDOC_DOCBOOK = docbook5
 ASCIIDOC_EXTRA += -acompat-mode -atabsize=8
 ASCIIDOC_EXTRA += -I. -rasciidoctor-extensions
-ASCIIDOC_EXTRA += -alitdd='&\#x2d;&\#x2d;'
+ASCIIDOC_EXTRA += -alitdd='\--'
+ASCIIDOC_EXTRA += -aplus='+'
+ASCIIDOC_COMMON += -a mansource="Git $(GIT_VERSION)" -a manmanual="Git Manual"
 DBLATEX_COMMON =
 XMLTO_EXTRA += --skip-validation
 XMLTO_EXTRA += -x manpage.xsl
diff --git a/Documentation/asciidoctor-extensions.rb
b/Documentation/asciidoctor-extensions.rb
index d906a00803..fb74443241 100644
--- a/Documentation/asciidoctor-extensions.rb
+++ b/Documentation/asciidoctor-extensions.rb
@@ -10,11 +10,16 @@ module Git

       def process(parent, target, attrs)
         prefix = parent.document.attr('git-relative-html-prefix')
+        s = "#{target}(#{attrs[1]})"
         if parent.document.doctype == 'book'
           "<ulink url=\"#{prefix}#{target}.html\">" \
           "#{target}(#{attrs[1]})</ulink>"
+        elsif parent.document.basebackend? 'manpage'
+          # FIXME: boldness should respect NO_MAN_BOLD_LITERAL?
+          # -- should be doable using an attribute, similar
+          # to "prefix" above
+          create_inline(parent, :quoted, s, type: :strong).convert
         elsif parent.document.basebackend? 'html'
           %(<a href="#{prefix}#{target}.html">#{target}(#{attrs[1]})</a>)
         elsif parent.document.basebackend? 'docbook'
           "<citerefentry>\n" \
             "<refentrytitle>#{target}</refentrytitle>" \
Previous: brian m. carlsonNext: Felipe Contreras
Message 37 of 38 in “[RFC suggestion] Generate manpage directly with Asciidoctor”
  1. Bagas SanjayaMay 7, 2021
  2. Randall S. BeckerMay 7, 2021
  3. Felipe ContrerasMay 7, 2021
  4. brian m. carlsonMay 7, 2021
  5. Randall S. BeckerMay 8, 2021
  6. Đoàn Trần Công DanhMay 7, 2021
  7. Bagas SanjayaMay 7, 2021
  8. Felipe ContrerasMay 7, 2021
  9. Bagas SanjayaMay 8, 2021
  10. brian m. carlsonMay 7, 2021
  11. Jeff KingMay 7, 2021
  12. Bagas SanjayaMay 8, 2021
  13. Martin ÅgrenMay 9, 2021
  14. Felipe ContrerasMay 9, 2021
  15. Martin ÅgrenMay 10, 2021
  16. Jeff KingMay 10, 2021
  17. Felipe ContrerasMay 11, 2021
  18. Jeff KingMay 11, 2021
  19. Felipe ContrerasMay 11, 2021
  20. Ævar Arnfjörð BjarmasonMay 11, 2021
  21. Felipe ContrerasMay 11, 2021
  22. Jeff KingMay 11, 2021
  23. Felipe ContrerasMay 11, 2021
  24. brian m. carlsonMay 11, 2021
  25. Felipe ContrerasMay 12, 2021
  26. Martin ÅgrenMay 11, 2021
  27. Jeff KingMay 11, 2021
  28. Martin ÅgrenMay 11, 2021
  29. Felipe ContrerasMay 11, 2021
  30. Jean-Noël AvilaMay 11, 2021
  31. Martin ÅgrenMay 11, 2021
  32. Felipe ContrerasMay 7, 2021
  33. brian m. carlsonMay 7, 2021
  34. Jeff KingMay 8, 2021
  35. Jeff KingMay 8, 2021
  36. brian m. carlsonMay 9, 2021
  37. Martin ÅgrenMay 9, 2021
  38. Felipe ContrerasMay 7, 2021

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.