Add non-ratified 'doc' mode to the template - #111
Conversation
Introduce a first-class mode switch so the template can serve non-ratified RISC-V documentation (e.g. docs-dev-guide), not only ratified specifications. A single committed .docmode file selects "spec" (today's behavior, byte-for- byte) or "doc". Absent => "spec", so existing spec repos are unaffected. doc mode keeps the ARC-form PDF, the Makefile HTML target, and the Antora site, but strips the ratification layer: no milestone phases, no "Document State" preface, no spec-state cover banner, no milestone version-bot PRs. - .docmode: new, self-documenting (value on line 1, # comments below). All five readers parse the first non-comment token, so missing/empty => spec. - scripts/release-info.sh: doc mode returns empty phase/display/notice/ milestone and does plain patch bumps; shared version plumbing unchanged. - Makefile: reads/exports DOC_MODE; passes -a doc-mode in doc mode; adds a reversible `make set-mode MODE=<spec|doc>` target. - src/spec-sample.adoc: ifndef::doc-mode[] guards on the Document State preface and the spec-state revremark default. - scripts/stamp-antora-version.sh: requires only version/revnumber/revdate in doc mode (no page-phase* keys). - modules/ROOT/pages/index.adoc: ifdef::page-phase-* guards on the cover version suffix and phase banner. - CI (build-pdf.yml, version-bot.yml): ignore the milestone target_phase inputs in doc mode; milestone-transition PRs collapse to none. - scripts/set-mode.sh: reversible in-place switch -- flips .docmode and reconciles antora.yml's page-phase* block, then re-stamps. - Docs: README.adoc "choose your mode" setup callout; ANTORA.md "Template modes" section; MIGRATION.md doc-mode path with docs-dev-guide as the worked example. Verified in both modes: spec-mode output byte-identical (regression safe); doc-mode PDF+HTML omit Document State; cover drops the phase banner; stamp handles a phase-less descriptor; set-mode round-trips idempotently. Closes #110 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
Rafael Sene (rpsene)
left a comment
There was a problem hiding this comment.
Bill Traynor (@wmat) doc mode is only verified locally. Since the template now ships two modes, add a doc-mode smoke build to CI so a future change can't silently break it. Also add a comment in set-mode.sh noting it assumes 4-space antora.yml indentation, since that awk is the fragile part.
Address PR #111 review: doc mode was only verified locally, so a future change could silently break it now that the template ships two modes. - build-pdf.yml: new PR-only doc-mode-smoke job. Builds the doc path via a DOC_MODE=doc env override and asserts a PDF lands, then round-trips set-mode.sh (spec -> doc -> spec) asserting the page-phase* block is stripped on doc and restored on spec -- guarding the fragile antora.yml awk. Independent of and gated away from the release/tag and stamp jobs. - set-mode.sh: FRAGILE note that the reconcile awk hard-codes the template's 4-space antora.yml indentation (matching stamp-antora-version.sh), what to update if reindented, and that CI round-trips it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Bill Traynor <wmat@riscv.org>
|
Thanks for the review — both addressed in a8fd252. Doc-mode CI smoke build ( set-mode.sh note: added a |
Summary
Adds a first-class mode switch so
docs-spec-templatecan serve non-ratifiedRISC-V documentation (e.g.
docs-dev-guide)as well as ratified specifications. A single committed
.docmodefile selectsspec(today's behavior, byte-for-byte) ordoc. Absent ⇒spec, so everyexisting spec repo is unaffected.
docmode keeps the ARC-form PDF, the Makefile HTML target, and the Antora site,but strips the ratification layer: no milestone phases, no "Document State"
preface, no spec-state cover banner, no milestone version-bot PRs.
Closes #110.
How it works
.docmode(self-documenting: value on line 1,#comments below) is read byrelease-info.sh, theMakefile,stamp-antora-version.sh, and CI — each parsesthe first non-comment token, so a missing/empty file resolves to
spec.SPEC_STATE.md,ARC_SUBMISSION.mdDiscoverability & reversibility
creating the repo sees it), and
.docmodeself-documents.make set-mode MODE=<spec|doc>switches an existing repo in place — flips.docmodeand reconcilesantora.yml'spage-phase*block, then re-stamps. Amis-selection is a reversible PR, not a repo recreation.
Files
.docmode(new),scripts/set-mode.sh(new),scripts/release-info.sh,scripts/stamp-antora-version.sh,Makefile,src/spec-sample.adoc,modules/ROOT/pages/index.adoc,.github/workflows/{build-pdf,version-bot}.yml,README.adoc,ANTORA.md,MIGRATION.md.Verification (local, both modes)
release-info.sh alloutput and a re-stamp ofantora.ymlare identical tomain; PDF still renders "Document State".cover renders with no phase banner and no trailing
: <display>.page-phase*) stamps cleanly; spec-modestamp on a phase-less file fails loudly (exit 3) rather than silently.
spec↔docidempotently;MODEguards fire.pre-commithooks pass;bash -nclean.Out of scope
Migrating the real
docs-dev-guiderepo — that lands as a separate PR in thatrepo; it is the worked example in
MIGRATION.mdhere.🤖 Generated with Claude Code