doc: document macros with MrDocs - #5
Closed
jll63 wants to merge 1 commit into
Closed
Conversation
MrDocs now extracts `#define` directives as symbols (cppalliance/mrdocs#1192), so the macro reference no longer has to be written by hand. Move the content of the sixteen hand-written BOOST_OPENMETHOD*.adoc pages into doc comments on the macros themselves, and delete the pages. `ref_macros.adoc` stays as the curated basic/advanced index, now pointing at the generated reference pages. Two macros needed restructuring to have a single documented definition: * BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS is only ever tested, never defined by the library, so there was no directive to extract. Add a documentation-only `#define` under `__MRDOCS__`, after `default_registry`, so documenting it cannot change what it documents. * BOOST_OPENMETHOD_EXPORT_REGISTRY and BOOST_OPENMETHOD_INSTANTIATE_REGISTRY had one definition per ABI. Move the per-platform bodies into BOOST_OPENMETHOD_DETAIL_* macros so the public macros are defined - and documented - once. Rename the macro parameters NAME and ARGS to ID and PARAMETERS. The generated synopsis prints the real parameter names, and the prose has always called them ID and PARAMETERS. Convert the {{MACRO}} placeholders in doc comments to `@ref MACRO`, which MrDocs resolves to a proper xref, and retarget the guide pages' xrefs at the generated pages. This removes two perl substitutions from build_antora.sh: the one that rewrote {{MACRO}} into a hand-built relative link, and the {{BASE_URL}} pass over the macro pages, which MrDocs now handles itself via base-url. Requires a MrDocs new enough to support macros; an older one silently produces no macro pages, which breaks the reference xrefs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
Author
|
Superseded by boostorg#83 — opened against the canonical repository instead. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MrDocs now extracts
#definedirectives as symbols (cppalliance/mrdocs#1192), so the macro reference no longer has to be written by hand.Changes
Doc comments on the macros. The content of the sixteen hand-written
BOOST_OPENMETHOD*.adocpages moves into//!comments inmacros.hpp,core.hppanddefault_registry.hpp— brief, description, notes, "Implementation Notes", and@paramfor every parameter. The pages are deleted;ref_macros.adocstays as the curated basic/advanced index, now pointing at the generated reference pages.Two macros needed restructuring to have a single documented definition:
BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKSis only ever tested, never defined by the library, so there was no directive to extract. It gets a documentation-only#defineunder__MRDOCS__, placed afterdefault_registryso documenting it cannot change what it documents.BOOST_OPENMETHOD_EXPORT_REGISTRYandBOOST_OPENMETHOD_INSTANTIATE_REGISTRYhad one definition per ABI. The per-platform bodies move intoBOOST_OPENMETHOD_DETAIL_*macros, so the public macros are defined — and documented — once instead of carrying duplicated doc comments.Macro parameters renamed
NAME/ARGS→ID/PARAMETERS. The generated synopsis prints the real parameter names (#define BOOST_OPENMETHOD(ID, PARAMETERS, ...)), and the prose has always called themIDandPARAMETERS.Links are real xrefs now.
{{MACRO}}placeholders in doc comments become@ref MACRO, which MrDocs resolves to anxref:; references to C++ symbols from macro pages use qualified names (@ref boost::openmethod::use_classes) since macros live in the global namespace. The guide pages'xref:BOOST_OPENMETHOD_X.adoc[becomexref:reference:BOOST_OPENMETHOD_X.adoc[(38 sites).build_antora.shloses two perl substitutions: the one that rewrote{{MACRO}}into a hand-built relative link, and the{{BASE_URL}}pass over the macro pages — MrDocs emits the "Declared in" GitHub link itself frombase-url.ref_headers.adocstill needs{{BASE_URL}}, so that one stays.doc/mrdocs.ymlgainsinclude-macros/exclude-macros.Testing
base_urlinref_headers.adoc, section levels, snippet tags). Every@refresolved — no literal@refleft in the generated adoc, and no_DETAIL_/GENSYM/GUIDEmacro leaked into the output.b2 -j12 toolset=gcc cxxstd=17intest/: 699 targets, all passed.-fsyntax-onlyover everytest/test_*.cppanddoc/modules/ROOT/examples/*.cpp: clean.clang-format -ion all edited headers.Notes
1./2.lines collapse into a single paragraph — so the enumerated dispatch rules use@libullets instead of numbers.xref:inside a doc comment gets entity-escaped by MrDocs. The guide still links to the macros, so the cross-reference works in one direction.reference:xrefs. My local cache was a build from two days before #1192 merged and had to be cleared.🤖 Generated with Claude Code