Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/mrdocs.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
9 changes: 9 additions & 0 deletions share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
9 changes: 9 additions & 0 deletions share/mrdocs/addons/generator/html/partials/symbol.html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@
{{/each}}
</div>
{{/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 }}
</div>
{{/unless}}
37 changes: 36 additions & 1 deletion src/lib/ConfigImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,42 @@ load(

// Config strings
c->configObj_ = toDomObject(s.configYaml);

c->settings_.visit([&c]<class T>(std::string_view name, T& value) {
if (!c->configObj_.exists(name))
{
if constexpr (std::convertible_to<T, std::string_view>)
{
c->configObj_.set(name, std::string(value));
}
else if constexpr (std::ranges::range<T>)
{
using ValueType = std::ranges::range_value_t<T>;
dom::Array arr;
for (auto const& v : value)
{
if constexpr (
std::is_same_v<ValueType, PathGlobPattern> ||
std::is_same_v<ValueType, SymbolGlobPattern>)
{
arr.emplace_back(v.pattern());
}
else
{
arr.emplace_back(v);
}
}
c->configObj_.set(name, std::move(arr));
}
else if constexpr (std::is_enum_v<T>)
{
c->configObj_.set(name, to_string(value));
}
else
{
c->configObj_.set(name, value);
}
}
});
return c;
}

Expand Down
7 changes: 7 additions & 0 deletions src/lib/ConfigOptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand Down
Loading