From 6668bba806c14af4d989e4c7419342adeaded3bb Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Tue, 12 Aug 2025 17:27:00 -0500 Subject: [PATCH 1/2] feat: templates receive config via reflection --- src/lib/ConfigImpl.cpp | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/lib/ConfigImpl.cpp b/src/lib/ConfigImpl.cpp index e5ffa5c1be..fab35bb8b0 100644 --- a/src/lib/ConfigImpl.cpp +++ b/src/lib/ConfigImpl.cpp @@ -119,7 +119,42 @@ load( // Config strings c->configObj_ = toDomObject(s.configYaml); - + c->settings_.visit([&c](std::string_view name, T& value) { + if (!c->configObj_.exists(name)) + { + if constexpr (std::convertible_to) + { + c->configObj_.set(name, std::string(value)); + } + else if constexpr (std::ranges::range) + { + using ValueType = std::ranges::range_value_t; + dom::Array arr; + for (auto const& v : value) + { + if constexpr ( + std::is_same_v || + std::is_same_v) + { + arr.emplace_back(v.pattern()); + } + else + { + arr.emplace_back(v); + } + } + c->configObj_.set(name, std::move(arr)); + } + else if constexpr (std::is_enum_v) + { + c->configObj_.set(name, to_string(value)); + } + else + { + c->configObj_.set(name, value); + } + } + }); return c; } From 4e4a756cbdd61d0a00537c8af44a3a4d4464f071 Mon Sep 17 00:00:00 2001 From: Alan de Freitas Date: Tue, 12 Aug 2025 17:28:55 -0500 Subject: [PATCH 2/2] feat: quick reference index page fix #242 fix #575 --- docs/mrdocs.schema.json | 10 ++++++++++ .../addons/generator/adoc/partials/symbol.adoc.hbs | 9 +++++++++ .../generator/common/partials/symbol/members-table.hbs | 2 +- .../addons/generator/html/partials/symbol.html.hbs | 9 +++++++++ src/lib/ConfigOptions.json | 7 +++++++ 5 files changed, 36 insertions(+), 1 deletion(-) diff --git a/docs/mrdocs.schema.json b/docs/mrdocs.schema.json index 3dea36755e..9d19e837ad 100644 --- a/docs/mrdocs.schema.json +++ b/docs/mrdocs.schema.json @@ -231,6 +231,16 @@ ], "title": "Generator used to create the documentation" }, + "global-namespace-index": { + "default": true, + "description": "When set to true, the page for the global namespace will recursively list all symbols in the documentation, not just those in the global namespace. This makes the global namespace page act as an index for the entire project.", + "enum": [ + true, + false + ], + "title": "Use the global namespace page as an index for all symbols", + "type": "boolean" + }, "ignore-failures": { "default": false, "description": "When set to true, MrDocs continues to generate the documentation even if there are AST visitation failures. AST visitation failures occur when the source code contains constructs that are not supported by MrDocs.", diff --git a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs index 855cd4be0a..acf7cae741 100644 --- a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs @@ -219,4 +219,13 @@ {{#each symbol.doc.sees}} {{>javadoc/see .}} {{/each}} +{{/if}} +{{! Recursive index for multipage global namespace }} +{{#if (and (eq symbol.kind "namespace") @root.config.multipage @root.config.global-namespace-index (eq @root.symbol.kind "namespace") (not @root.symbol.name) (not @root.symbol.parent)) }} +{{#each symbol.members.namespaces}} +{{#if isRegular}} +{{#> markup/dynamic-level-h id=null }}{{> symbol/qualified-name . }} namespace{{/markup/dynamic-level-h}} +{{> symbol symbol=. id=null traversing-global-namespace=true }} +{{/if}} +{{/each}} {{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/members-table.hbs b/share/mrdocs/addons/generator/common/partials/symbol/members-table.hbs index 5b104158a2..fb8f535842 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/members-table.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/members-table.hbs @@ -16,7 +16,7 @@ --}} {{#if members}} {{#if (or (eq members[0].class "name") (any_of_by members "isRegular" "isSeeBelow"))}} -{{#>markup/h level=(select @root.config.multipage 1 2)}}{{title}}{{/markup/h}} +{{#>markup/h level=(select @root.config.multipage (select traversing-global-namespace 2 1) 2)}}{{title}}{{/markup/h}} {{>symbol/detail/members-table-impl members=members isName=(eq members[0].class "name") includeBrief=(select (any_of_by members "doc") true false) title=title}} {{/if}} diff --git a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs index 81815f162a..77b1dcc780 100644 --- a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs @@ -313,6 +313,15 @@ {{/each}} {{/if}} +{{! Recursive index for multipage global namespace }} +{{#if (and (eq symbol.kind "namespace") @root.config.multipage @root.config.global-namespace-index (eq @root.symbol.kind "namespace") (not @root.symbol.name) (not @root.symbol.parent)) }} +{{#each symbol.members.namespaces}} +{{#if isRegular}} +{{#> markup/dynamic-level-h id=null }}{{> symbol/qualified-name . }} namespace{{/markup/dynamic-level-h}} +{{> symbol symbol=. id=null traversing-global-namespace=true }} +{{/if}} +{{/each}} +{{/if}} {{#unless @root.config.multipage }} {{/unless}} diff --git a/src/lib/ConfigOptions.json b/src/lib/ConfigOptions.json index 872d456504..2e780967b9 100644 --- a/src/lib/ConfigOptions.json +++ b/src/lib/ConfigOptions.json @@ -409,6 +409,13 @@ "details": "When set to true, MrDocs creates a page for each namespace in the documentation.", "type": "bool", "default": true + }, + { + "name": "global-namespace-index", + "brief": "Use the global namespace page as an index for all symbols", + "details": "When set to true, the page for the global namespace will recursively list all symbols in the documentation, not just those in the global namespace. This makes the global namespace page act as an index for the entire project.", + "type": "bool", + "default": true } ] },