Skip to content

Support both asciidoctor and asciidoc-py for man pages - #2479

Merged
ni4 merged 2 commits into
mainfrom
adoc-manpages-asciidoc-py
Sep 2, 2026
Merged

Support both asciidoctor and asciidoc-py for man pages#2479
ni4 merged 2 commits into
mainfrom
adoc-manpages-asciidoc-py

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Implements #2395 the "git way": man pages can now be generated with either supported AsciiDoc toolchain, and CI keeps the sources honest about it.

  • cmake/Modules/AdocMan.cmake now picks a backend: asciidoctor -b manpage (preferred, no extra deps) → asciidoc + xsltproc (the a2x docbook pipeline distros already ship) → pre-generated docs/man/ cache. ASCIIDOC_TOOL=asciidoc forces the docbook pipeline.
  • New cmake/Modules/adoc-manpage.xsl: stock docbook-xsl manpages sheet plus the adjustments a2x's bundled sheet applies (ulink text-only, no auto-REFERENCES, quiet output), and a template mapping the <?asciidoc-br?> PI (+ hard line breaks, which stock docbook-xsl silently drops) to roff .br.
  • Man page sources brought into the common asciidoc/asciidoctor subset:
    • NAME sections start with the page's own name (rnp, rnpkeys, librnp) — required because docbook-xsl names its output after the first refname, and the correct whatis name anyway;
    • librnp(3) SYNOPSIS uses a literal block instead of +-joined bold lines;
    • removed constructs the two tools render differently: *"quoted text"* / *_-_* (span-end disagreement) and bare <user@domain> / user@domain shapes in running text (asciidoctor macro-ifies emails, asciidoc-py does not).
  • ci/check-man-pages.sh + new man-pages workflow: builds all three pages with both toolchains, fails on any stderr output (like git's ci/test-documentation.sh), and diffs the normalized rendered output so silent divergence cannot creep in.
  • docs/develop.adoc documents the two toolchains and the common-subset rules; docs/man/ cache refreshed (asciidoctor stays canonical for the cache).

Rendered output from both toolchains is verified identical modulo known cosmetics (sentence spacing, footer date format, AUTHOR section shape), which the check normalizes away.

Test plan

  • cmake -DASCIIDOC_TOOL=asciidoc build + DESTDIR install of all three man pages via asciidoc-py 10.2.1 + docbook-xsl 1.79.2
  • Default configure picks asciidoctor; --no-toolchain configure falls back to the docs/man cache
  • ci/check-man-pages.sh passes (both toolchains, zero warnings, identical normalized renders); shellcheck clean
  • CI man-pages workflow green on ubuntu (apt asciidoctor + asciidoc + docbook-xsl)

Closes #2395

Man pages can now be built with either toolchain (#2395): asciidoctor's
native manpage backend (preferred, no extra dependencies), or classic
Python asciidoc via docbook XML + xsltproc, as asciidoc has no manpage
backend. The new cmake/Modules/adoc-manpage.xsl supplements stock
docbook-xsl with the same adjustments a2x applies, plus maps the
asciidoc-br processing instruction (dropped by stock docbook-xsl) to
roff .br requests. CMake prefers asciidoctor, falls back to
asciidoc + xsltproc, then to the pre-generated docs/man cache;
ASCIIDOC_TOOL=asciidoc forces the docbook pipeline.

To keep the sources renderable by both tools:

- NAME sections now start with the page's own name (docbook-xsl names
  its output after the first refname, and it is the correct whatis name)
- librnp(3) SYNOPSIS uses a literal block instead of + hard line breaks
- email-shaped text and quotes nested in emphasis markers are avoided
  (asciidoctor macro-ifies user@domain and disagrees with asciidoc on
  where strong spans containing quotes end)

ci/check-man-pages.sh, run by the new man-pages workflow, builds every
page with both toolchains and fails on warnings or render divergence,
modeled on git's ci/test-documentation.sh. docs/man/ is refreshed.
asciidoc-py < 10.2.1 emits Python SyntaxWarnings from its own config on
Python 3.12+, which tripped the zero-stderr policy on ubuntu-24.04.
Filter that line, as git ci/test-documentation.sh does.
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.46%. Comparing base (cc4b4ea) to head (8b15199).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2479      +/-   ##
==========================================
- Coverage   85.47%   85.46%   -0.01%     
==========================================
  Files         125      125              
  Lines       22962    22962              
==========================================
- Hits        19626    19625       -1     
- Misses       3336     3337       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ronaldtse
ronaldtse requested a review from ni4 September 2, 2026 08:46
@ronaldtse

Copy link
Copy Markdown
Contributor Author

@eli-schwartz thank you again for the report and for the correction about a2x -- we went ahead and did it the git way!

Man pages can now be built with either toolchain: asciidoctor with its native manpage backend when available, or classic Python asciidoc via docbook + xsltproc (the same a2x pipeline you described). CMake auto-detects whichever is installed, so no asciidoctor is needed; -DASCIIDOC_TOOL=asciidoc forces the asciidoc route explicitly. The pre-generated docs/man/ fallback is still there for environments without any AsciiDoc toolchain.

Following git's example, CI now builds all the pages with both toolchains and fails on any warning or rendering divergence, so the sources cannot drift into tool-specific syntax.

Could you give it a spin and let us know whether this covers your packaging use case? Thank you!

@ni4 ni4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! @ronaldtse I believe we could merge it with a single approval?

@ronaldtse

Copy link
Copy Markdown
Contributor Author

Yes, agree! Please help merge it!

@ni4
ni4 merged commit 197093a into main Sep 2, 2026
146 of 150 checks passed
@ni4
ni4 deleted the adoc-manpages-asciidoc-py branch September 2, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please support asciidoc (py) instead of or in addition to asciidoctor for producing manpages

2 participants