Skip to content

Help model: roff (man-page) backend (#154) - #377

Merged
helly25 merged 1 commit into
mainfrom
feat/help-roff-backend
Aug 5, 2026
Merged

Help model: roff (man-page) backend (#154)#377
helly25 merged 1 commit into
mainfrom
feat/help-roff-backend

Conversation

@helly25

@helly25 helly25 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Adds RoffBackend over the help_model AST, completing the backend trio (plain / markdown / roff).

Renders a Document to man-page source: .TH/.SH/.SS structure, upper-cased section headings (man convention), .TP entries, inline code/strong -> \fB, emphasis -> \fI, SEE ALSO -> .BR name (sec), plus the RoffEscape() escaper (hyphens, backslashes, leading ./' control chars). The model counterpart of manpage.cc's RoffRenderer.

Additive - --man still renders through the DocRenderer walk. Note: the eventual --man port will not be byte-identical, because BuildReference() parses backticks in entry details (the old renderer emitted them literally), so those become bold - an improvement. Wiring the CLI onto the model therefore regenerates XFF.md + the man golden; that's the next slice, gated on the output-format decision.

bazel test //xff/cli:roff_backend_test passes.

Completes the backend trio (plain / markdown / roff) over help_model:
RoffBackend renders a Document to man-page source - .TH/.SH/.SS structure,
upper-cased section headings, .TP entries, code/strong -> \fB, emphasis ->
\fI, SEE ALSO -> .BR, and the RoffEscape() escaper (hyphens, backslashes,
leading control chars). The model counterpart of manpage.cc's RoffRenderer.

Additive: --man still uses the DocRenderer walk. Note the port will not be
byte-identical - BuildReference() parses backticks in entry details, which
the old RoffRenderer emitted literally, so the ported man page renders those
as bold (an improvement). Wiring --man/--markdown/--help onto the model
therefore regenerates XFF.md + the man golden, which is the next slice
(gated on the output-format decision).
@helly25
helly25 enabled auto-merge (squash) August 5, 2026 23:29
@helly25
helly25 merged commit c85044a into main Aug 5, 2026
9 checks passed
@helly25
helly25 deleted the feat/help-roff-backend branch August 5, 2026 23:40
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.

1 participant