diff --git a/include/mrdocs/Support/Handlebars.hpp b/include/mrdocs/Support/Handlebars.hpp index b349ac92d..5811f4356 100644 --- a/include/mrdocs/Support/Handlebars.hpp +++ b/include/mrdocs/Support/Handlebars.hpp @@ -1221,6 +1221,17 @@ MRDOCS_DECL void registerContainerHelpers(Handlebars& hbs); +/** Register type helpers into a Handlebars instance + + This function registers a number of common helpers that operate on + types, such as identity, type checking, and type conversion. + + @param hbs The Handlebars instance to register the helpers into + */ +MRDOCS_DECL +void +registerTypeHelpers(Handlebars& hbs); + /** "and" helper function * * The "and" helper returns true if all of the values are truthy. diff --git a/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs index 615574bc3..172ba3efc 100644 --- a/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/markup/a.adoc.hbs @@ -4,7 +4,7 @@ https://gitlab.com/antora/antora/-/issues/428 }} {{#if (starts_with href "#")~}} - <<{{{remove_prefix href "#"}}},{{> @partial-block }}>> + link:{{{ href }}}[{{> @partial-block }}] {{~else if (starts_with href "/")~}} xref:{{{remove_prefix href "/"}}}[{{> @partial-block }}] {{~else if (starts_with href ".")~}} diff --git a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs index 7c3fd37bf..855cd4be0 100644 --- a/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs +++ b/share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs @@ -63,11 +63,7 @@ | Name | Description {{#each (filter_by symbol.constants "isRegular" "isSeeBelow")}} -{{#if (ne kind "enum-constant")}} -|xref:{{{anchor}}}[`{{>symbol/name . nolink=true}}`] -{{else}} -|`{{>symbol/name . nolink=true}}` -{{/if}} +|`{{>symbol/name-text .}}` |{{> javadoc/inline-brief doc.brief }} {{/each}} |=== @@ -121,9 +117,9 @@ | Description {{#each symbol.derived}} | {{#if url~}} -{{#>markup/a href=url}}{{#>markup/code}}{{> symbol/name-info . nolink=true}}{{/markup/code}}{{/markup/a}} +{{#>markup/a href=url}}{{#>markup/code}}{{> type/name-info-text . }}{{/markup/code}}{{/markup/a}} {{else~}} -{{> symbol/name-info . nolink=true}} +{{> type/name-info-text . }} {{/if}} | {{> javadoc/inline-brief doc.brief }} {{/each}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/detail/members-table-row.hbs b/share/mrdocs/addons/generator/common/partials/symbol/detail/members-table-row.hbs index f8ba6854b..52fb4bd6e 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/detail/members-table-row.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/detail/members-table-row.hbs @@ -2,12 +2,14 @@ {{#>markup/tr}} {{#>markup/td~}} {{~#if isName~}} +{{!~ The first row is a name-info ~}} {{~#if symbol.url~}} -{{~#>markup/a href=symbol.url}}{{#>markup/code}}{{> symbol/name-info . nolink=true}}{{/markup/code}}{{/markup/a~}} +{{~#>markup/a href=symbol.url}}{{#>markup/code}}{{> type/name-info-text . }}{{/markup/code}}{{/markup/a~}} {{~else~}} -{{~> symbol/name-info . nolink=true~}} +{{~> type/name-info-text . ~}} {{~/if~}} {{~else~}} +{{!~ The first row is a name-info ~}} {{~#>markup/a href=url}}{{#>markup/code}}{{>symbol/name-text .}}{{/markup/code}}{{/markup/a}} {{>symbol/special-function-suffix .~}} {{~/if~}} {{~/markup/td}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/name-text.hbs b/share/mrdocs/addons/generator/common/partials/symbol/name-text.hbs index 40692c363..3a80cf8ac 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/name-text.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/name-text.hbs @@ -6,10 +6,6 @@ Expected Context: {Symbol Object} - Optional parameters: - nolink: If true, types and symbols will not be linked. - link: Symbol that should be linked to, regardless of the original symbol. - Example: {{> declarator symbol }} @@ -17,10 +13,10 @@ --}} {{~#if (and (eq kind "function") (eq functionClass "conversion"))~}} {{! Conversion operator: "operator" and the type declarator ~}} - operator {{>type/declarator return nolink=true~}} + operator {{>type/declarator-text return ~}} {{~else if (eq kind "guide")~}} {{! Deduction guide: "deduced" type declarator ~}} - {{>type/declarator deduced nolink=true~}} + {{>type/declarator-text deduced ~}} {{~else~}} {{! Symbol with URL: link to the symbol documentation ~}} {{~#if name~}} @@ -32,6 +28,6 @@ {{~/if~}} {{~#if (contains (arr "explicit" "partial") template.kind)~}} {{! Explicit or partial template: render the template arguments ~}} - {{>template/args args=template.args nolink=true~}} + {{>template/args-text args=template.args ~}} {{~/if~}} {{~/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/name.hbs b/share/mrdocs/addons/generator/common/partials/symbol/name.hbs index c3a1e6660..a458587ac 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/name.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/name.hbs @@ -6,9 +6,6 @@ Expected Context: {Symbol Object} - Optional parameters: - nolink: If true, types and symbols will not be linked. - Example: {{> declarator symbol }} @@ -16,11 +13,11 @@ --}} {{~#if (and (eq kind "function") (eq functionClass "conversion"))~}} {{! Conversion operator: "operator" and the type declarator ~}} - operator {{>type/declarator return nolink=false~}} + operator {{>type/declarator return ~}} {{~else if (eq kind "guide")~}} {{! Deduction guide: "deduced" type declarator ~}} - {{>type/declarator deduced nolink=false~}} -{{~else if (and url (not nolink))~}} + {{>type/declarator deduced ~}} +{{~else if url~}} {{#>markup/a href=url}}{{>symbol/name-text}}{{/markup/a~}} {{~else~}} {{~>symbol/name-text~}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/qualified-name-title.hbs b/share/mrdocs/addons/generator/common/partials/symbol/qualified-name-title.hbs index 5aa4bfad9..ed3433e3a 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/qualified-name-title.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/qualified-name-title.hbs @@ -31,11 +31,11 @@ {{~> symbol/name . ~}} {{~/if~}} {{~else if (eq kind "guide")~}} - {{>type/declarator deduced nolink=false~}} + {{>type/declarator deduced ~}} {{~else if (contains (arr "explicit" "partial") template.kind)~}} {{!~ If the last part is a template specialization, we include links to primary template and the arguments. ~}} {{!~ If the primary template wasn't correctly extracted for some reason, we just print the name as usual. ~}} - {{#if template.primary }}{{~>symbol/name template.primary ~}}{{else}}{{ name }}{{/if}}{{>template/args args=template.args nolink=false~}} + {{#if template.primary }}{{~>symbol/name template.primary ~}}{{else}}{{ name }}{{/if}}{{>template/args args=template.args ~}} {{~else~}} {{~> symbol/name-text . ~}} {{~/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/qualified-name.hbs b/share/mrdocs/addons/generator/common/partials/symbol/qualified-name.hbs index 273da92d3..2c2413519 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/qualified-name.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/qualified-name.hbs @@ -11,7 +11,7 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} -{{~#if (and url (not nolink))~}} +{{~#if url~}} {{#>markup/a href=url}}{{>symbol/qualified-name-text}}{{/markup/a~}} {{~else~}} {{~>symbol/qualified-name-text~}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature.hbs index 9d06caa9a..226239421 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature.hbs @@ -11,4 +11,4 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} -{{> (concat 'symbol/signature/' kind) nolink=nolink }} \ No newline at end of file +{{> (concat 'symbol/signature/' kind) }} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs index 5d8857b38..1c3c8c31a 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs @@ -19,7 +19,7 @@ {{~else if (eq functionClass "conversion")~}} {{>symbol/name symbol }} {{~else if (contains (arr "explicit" "partial") template.kind)~}} -{{>symbol/name template.primary ~}}{{>template/args args=template.args nolink=true~}} +{{>symbol/name template.primary ~}}{{>template/args-text args=template.args ~}} {{~else~}} {{>symbol/name-text symbol }} {{~/if~}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/namespace-alias.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/namespace-alias.hbs index cdc7fdb24..a2386ecfa 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/namespace-alias.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/namespace-alias.hbs @@ -1 +1 @@ -namespace {{ name }} = {{> symbol/name-info aliasedSymbol }}; \ No newline at end of file +namespace {{ name }} = {{> type/name-info aliasedSymbol }}; \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs index f1a1ceefd..78f1767b8 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs @@ -2,7 +2,7 @@ {{/if~}} {{#if isFriend}}friend {{/if~}} {{~tag}} {{#if (contains (arr "explicit" "partial") template.kind)~}} - {{>symbol/name template.primary ~}}{{>template/args args=template.args nolink=nolink~}} + {{>symbol/name template.primary ~}}{{>template/args args=template.args ~}} {{~else~}} {{>symbol/name-text symbol ~}} {{~/if}} diff --git a/share/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs b/share/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs index d3e24e2b1..5d85b11d3 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs +++ b/share/mrdocs/addons/generator/common/partials/symbol/signature/using.hbs @@ -1,5 +1,5 @@ using {{#if (contains (arr "typename" "enum") usingClass)}} {{usingClass}} {{~/if~}} {{~#if qualifier~}} - {{>symbol/name-info qualifier }}:: + {{>type/name-info qualifier }}:: {{~/if}}{{name}}; \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/arg-text.hbs b/share/mrdocs/addons/generator/common/partials/template/arg-text.hbs new file mode 100644 index 000000000..b833aaf3d --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/template/arg-text.hbs @@ -0,0 +1,13 @@ +{{!-- + Renders a template argument as text. + + This partial renders a template argument for a template instantiation. + + Expected Context: {TArg} + + Example: + {{> template/arg symbol.template.args[0] }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~>template/arg . link-components-impl=false ~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/arg.hbs b/share/mrdocs/addons/generator/common/partials/template/arg.hbs index d6811ad29..601600679 100644 --- a/share/mrdocs/addons/generator/common/partials/template/arg.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/arg.hbs @@ -1,6 +1,5 @@ {{!-- - - Renders a template argument. + Renders a template argument with links to any named component. This partial renders a template argument for a template instantiation. @@ -13,13 +12,19 @@ --}} {{#if (eq kind "type")~}} {{! TArg is a type: render the declarator ~}} - {{~>type/declarator type nolink=nolink~}} + {{~>type/declarator type link-components-impl=link-components-impl~}} {{else if (eq kind "non-type")~}} {{! TArg is a non-type: render the value string as is ~}} {{~value~}} {{else if (eq kind "template")~}} {{! TArg is another template: render the template head ~}} - {{#if (and template (not nolink))}}{{#>markup/a href=template.url}}{{name}}{{/markup/a}}{{else~}}{{name~}}{{/if~}} + {{~#if (and template template.url (or link-components-impl (is_undefined link-components-impl)))~}} + {{~#>markup/a href=template.url~}} + {{~name~}} + {{~/markup/a~}} + {{~else~}} + {{name~}} + {{~/if~}} {{/if~}} {{~#if is-pack~}} {{ str "..." }} diff --git a/share/mrdocs/addons/generator/common/partials/template/args-text.hbs b/share/mrdocs/addons/generator/common/partials/template/args-text.hbs new file mode 100644 index 000000000..a3c27132f --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/template/args-text.hbs @@ -0,0 +1,13 @@ +{{!-- + Renders all template arguments as text. + + This partial renders all template arguments for a template instantiation. + + Expected Context: {Template Info} + + Example: + {{> template/args symbol.template.args }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~>template/args link-components-impl=false~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/args.hbs b/share/mrdocs/addons/generator/common/partials/template/args.hbs index f394655ca..a0da252fb 100644 --- a/share/mrdocs/addons/generator/common/partials/template/args.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/args.hbs @@ -1,6 +1,5 @@ {{!-- - - Renders all template arguments. + Renders all template arguments with links to any named component. This partial renders all template arguments for a template instantiation. @@ -12,6 +11,6 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} {{ str '<' }}{{~#each args~}} -{{~>template/arg nolink=../nolink~}} +{{~>template/arg link-components-impl=../link-components-impl~}} {{~#if (not @last)}}, {{/if~}} {{~/each~}}{{ str '>' }} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/head-text.hbs b/share/mrdocs/addons/generator/common/partials/template/head-text.hbs new file mode 100644 index 000000000..7a28c543a --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/template/head-text.hbs @@ -0,0 +1,13 @@ +{{!-- + Renders the template head for a template declaration as text. + + This partial renders the template head with all the template parameters. + + Expected Context: {Template Info} + + Example: + {{> template/head symbol.template }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~>template/head-text link-components-impl=link-components-impl~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/head.hbs b/share/mrdocs/addons/generator/common/partials/template/head.hbs index f6dff735e..b68c59dc8 100644 --- a/share/mrdocs/addons/generator/common/partials/template/head.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/head.hbs @@ -1,5 +1,5 @@ {{!-- - Renders the template head for a template declaration. + Renders the template head for a template declaration with links to any named component. This partial renders the template head with all the template parameters. @@ -11,7 +11,7 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} template{{ str '<' }}{{#each params}}{{#unless (and @first @last)}} - {{/unless}}{{>template/param~}} + {{/unless}}{{>template/param link-components-impl=link-components-impl~}} {{#unless @last}},{{/unless~}} {{/each}}{{ str '>' }}{{#if requires}} requires {{requires}}{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/param-text.hbs b/share/mrdocs/addons/generator/common/partials/template/param-text.hbs new file mode 100644 index 000000000..1f11c5272 --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/template/param-text.hbs @@ -0,0 +1,15 @@ +{{!-- + Renders a template parameter as text. + + If the template parameter is a type, the templated type name is rendered. + If the template parameter is a non-type, the declarator of the type is rendered. + If the template parameter is a template, the template head is rendered. + + Expected Context: {TParam} + + Example: + {{> template/param tparam }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~> template/param . link-components-impl=false ~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/template/param.hbs b/share/mrdocs/addons/generator/common/partials/template/param.hbs index fcbf49794..808e7c533 100644 --- a/share/mrdocs/addons/generator/common/partials/template/param.hbs +++ b/share/mrdocs/addons/generator/common/partials/template/param.hbs @@ -1,6 +1,5 @@ {{!-- - - Renders a template parameter. + Renders a template parameter with links to any named components. If the template parameter is a type, the templated type name is rendered. If the template parameter is a non-type, the declarator of the type is rendered. @@ -14,15 +13,15 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} {{#if (eq kind "type")~}} - {{#if constraint}}{{>symbol/name-info constraint }}{{else}}{{key}}{{/if~}} + {{#if constraint}}{{>type/name-info constraint link-components-impl=link-components-impl }}{{else}}{{key}}{{/if~}} {{#if is-pack}}{{ str "..." }}{{/if~}} {{#if name}} {{name}}{{/if~}} - {{#if default}} = {{>template/arg default~}}{{/if~}} + {{#if default}} = {{>template/arg default link-components-impl=link-components-impl ~}}{{/if~}} {{else if (eq kind "non-type")~}} - {{>type/declarator type decl-name=name}}{{#if is-pack}}{{ str "..." }}{{/if~}} - {{#if default}} = {{>template/arg default~}}{{/if~}} + {{>type/declarator type decl-name=name link-components-impl=link-components-impl }}{{#if is-pack}}{{ str "..." }}{{/if~}} + {{#if default}} = {{>template/arg default link-components-impl=link-components-impl~}}{{/if~}} {{else if (eq kind "template")~}} {{>template/head}} typename{{#if is-pack}}{{ str "..." }}{{/if~}} {{#if name}} {{name}}{{/if~}} - {{#if default}} = {{>template/arg default~}}{{/if~}} + {{#if default}} = {{>template/arg default link-components-impl=link-components-impl~}}{{/if~}} {{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator-prefix-text.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator-prefix-text.hbs new file mode 100644 index 000000000..0fb77d974 --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/type/declarator-prefix-text.hbs @@ -0,0 +1,14 @@ +{{!-- + Renders declaration prefix of a Type Info Object as text. + + The prefix is the part of the declaration that comes before the type name. + It includes the pointer, array, and function declarators. + + Expected Context: {Type Info} + + Example: + {{> declarator-prefix type }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~>type/declarator-prefix . link-components-impl=false ~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator-prefix.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator-prefix.hbs index b49fa8111..20e9206d1 100644 --- a/share/mrdocs/addons/generator/common/partials/type/declarator-prefix.hbs +++ b/share/mrdocs/addons/generator/common/partials/type/declarator-prefix.hbs @@ -1,14 +1,11 @@ {{!-- - Renders declaration prefix of a Type Info Object. + Renders declaration prefix of a Type Info Object with links to any named components. The prefix is the part of the declaration that comes before the type name. It includes the pointer, array, and function declarators. Expected Context: {Type Info} - Optional parameters: - nolink: If true, types and symbols will not be linked. - Example: {{> declarator-prefix type }} @@ -16,7 +13,7 @@ --}} {{#if pointee-type~}} {{! Pointee type is array or function ~}} - {{~>type/declarator-prefix pointee-type nolink=nolink~}} + {{~>type/declarator-prefix pointee-type link-components-impl=link-components-impl~}} {{#if (contains (arr "array" "function") pointee-type.kind)~}} {{! Open the function parenthesis for the declarator suffix ~}} {{! The symbol name will be rendered between the prefix and suffix ~}} @@ -25,19 +22,19 @@ {{~/if~}} {{#if element-type~}} {{! Array type declarator prefix includes prefix of element type ~}} - {{~>type/declarator-prefix element-type nolink=nolink~}} + {{~>type/declarator-prefix element-type link-components-impl=link-components-impl~}} {{/if~}} {{#if return-type~}} {{! Function prefix includes prefix of return type ~}} - {{~>type/declarator-prefix return-type nolink=nolink~}} + {{~>type/declarator-prefix return-type link-components-impl=link-components-impl~}} {{/if~}} {{#if (eq kind "named")~}} {{! Named type declarator prefix includes the name ~}} - {{>symbol/name-info name nolink=nolink }} + {{>type/name-info name link-components-impl=link-components-impl }} {{~else if (eq kind "auto")~}} {{! Auto type declarator prefix includes the keyword ~}} {{#if constraint~}} - {{>symbol/name-info constraint nolink=nolink }} {{/if~}} + {{>type/name-info constraint link-components-impl=link-components-impl }} {{/if~}} {{keyword~}} {{~/if~}} {{#if is-const~}} @@ -57,7 +54,7 @@ * {{~ else if (eq kind "member-pointer")~}} {{! Member pointer declarator prefix includes the class name ~}} - {{>type/declarator parent-type nolink=nolink}}::* + {{>type/declarator parent-type link-components-impl=link-components-impl}}::* {{~ else if (eq kind "decltype")~}} {{! Decltype declarator prefix includes the expression ~}} decltype({{operand}}) diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator-suffix-text.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator-suffix-text.hbs new file mode 100644 index 000000000..f70484e87 --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/type/declarator-suffix-text.hbs @@ -0,0 +1,15 @@ +{{!-- + Renders declaration suffix of a Type Info Object as text. + + The suffix is the part of the declaration that comes after the type name. + It might include the suffix for pointee types, array element types, + or function parameters with specifiers. + + Expected Context: {Type Info} + + Example: + {{> declarator-suffix type }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~>type/declarator-suffix . link-components-impl=false~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator-suffix.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator-suffix.hbs index fdb04fac7..96c610609 100644 --- a/share/mrdocs/addons/generator/common/partials/type/declarator-suffix.hbs +++ b/share/mrdocs/addons/generator/common/partials/type/declarator-suffix.hbs @@ -1,5 +1,5 @@ {{!-- - Renders declaration suffix of a Type Info Object. + Renders declaration suffix of a Type Info Object with links to any named components. The suffix is the part of the declaration that comes after the type name. It might include the suffix for pointee types, array element types, @@ -7,9 +7,6 @@ Expected Context: {Type Info} - Optional parameters: - nolink: If true, types and symbols will not be linked. - Example: {{> declarator-suffix type }} @@ -23,15 +20,15 @@ ) {{~/if~}} {{! Declarator suffix of the pointee type ~}} - {{~>type/declarator-suffix pointee-type nolink=nolink~}} + {{~>type/declarator-suffix pointee-type link-components-impl=link-components-impl~}} {{else if (eq kind "array")~}} {{! Array declarator suffix includes bounds and array element suffix ~}} [{{bounds-value}}] - {{~>type/declarator-suffix element-type nolink=nolink~}} + {{~>type/declarator-suffix element-type link-components-impl=link-components-impl~}} {{else if (eq kind "function")~}} {{! Function declarator suffix includes parameter types and cv-qualifiers ~}} ({{#each param-types~}} - {{~>type/declarator nolink=../nolink~}} + {{~>type/declarator link-components-impl=link-components-impl~}} {{~#unless @last}}, {{/unless~}} {{/each~}} {{! Include final "..." for variadic functions ~}} @@ -43,5 +40,5 @@ {{! Exception spec as literal string ~}} {{#if exception-spec}} {{exception-spec}}{{/if~}} {{! Declarator suffix of the return type ~}} - {{~>type/declarator-suffix return-type nolink=nolink~}} + {{~>type/declarator-suffix return-type link-components-impl=link-components-impl~}} {{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator-text.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator-text.hbs new file mode 100644 index 000000000..b3b9547f6 --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/type/declarator-text.hbs @@ -0,0 +1,16 @@ +{{!-- + Renders a Type Info Object as a declaration as text. + + Expected Context: {Type Info} + + Optional parameters: + decl-name: The symbol name for the declaration. + decl-name-targs: The symbol template arguments for the declaration. + + Example: + {{> declarator type }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{! Render the prefix of the declaration. ~}} +{{>type/declarator link-components-impl=false decl-name=decl-name decl-name-targs=decl-name-targs~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/declarator.hbs b/share/mrdocs/addons/generator/common/partials/type/declarator.hbs index 6b8068de8..5591b8165 100644 --- a/share/mrdocs/addons/generator/common/partials/type/declarator.hbs +++ b/share/mrdocs/addons/generator/common/partials/type/declarator.hbs @@ -1,12 +1,11 @@ {{!-- - Renders a Type Info Object as a declaration. + Renders a Type Info Object as a declaration with links to any named components. Expected Context: {Type Info} Optional parameters: decl-name: The symbol name for the declaration. decl-name-targs: The symbol template arguments for the declaration. - nolink: If true, types and symbols will not be linked. Example: {{> declarator type }} @@ -14,12 +13,12 @@ See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} {{! Render the prefix of the declaration. ~}} -{{>type/declarator-prefix nolink=nolink~}} +{{>type/declarator-prefix link-components-impl=link-components-impl~}} {{! Render the symbol name between the prefix and suffix. ~}} {{~#if decl-name}} {{decl-name~}} {{~#if decl-name-targs~}} - {{>template/args args=decl-name-targs nolink=nolink}} + {{>template/args args=decl-name-targs link-components-impl=link-components-impl}} {{~/if~}} {{~/if~}} {{! Render the suffix of the declaration. ~}} -{{~>type/declarator-suffix nolink=nolink}} \ No newline at end of file +{{~>type/declarator-suffix link-components-impl=link-components-impl}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/name-info-text.hbs b/share/mrdocs/addons/generator/common/partials/type/name-info-text.hbs new file mode 100644 index 000000000..49f26eb45 --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/type/name-info-text.hbs @@ -0,0 +1,15 @@ +{{!-- + Renders a Name Info object as text. + + Name Info objects are fields of a Type Object when + they carry information about the Symbol the type + refers to, including its name. + + Expected Context: {Name Info Object} + + Example: + {{> type/name-info name }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{~> type/name-infos . link-components-impl=false ~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/type/name-info.hbs b/share/mrdocs/addons/generator/common/partials/type/name-info.hbs new file mode 100644 index 000000000..8ea66445a --- /dev/null +++ b/share/mrdocs/addons/generator/common/partials/type/name-info.hbs @@ -0,0 +1,19 @@ +{{!-- + Renders a Name Info object with links to any named components. + + Name Info objects are fields of a Type Object when + they carry information about the Symbol the type + refers to, including its name. + + Expected Context: {Name Info Object} + + Example: + {{> type/name-info name }} + + See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference +--}} +{{#if (and symbol.url (or link-components-impl (is_undefined link-components-impl))) ~}} +{{~#>markup/a href=symbol.url}}{{> type/name-info-text . ~}}{{/markup/a~}} +{{~else~}} +{{~> type/name-info-text . ~}} +{{~/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/common/partials/symbol/name-info.hbs b/share/mrdocs/addons/generator/common/partials/type/name-infos.hbs similarity index 50% rename from share/mrdocs/addons/generator/common/partials/symbol/name-info.hbs rename to share/mrdocs/addons/generator/common/partials/type/name-infos.hbs index 781b6a5af..5cc446738 100644 --- a/share/mrdocs/addons/generator/common/partials/symbol/name-info.hbs +++ b/share/mrdocs/addons/generator/common/partials/type/name-infos.hbs @@ -1,29 +1,26 @@ {{!-- - Renders a Name Info object. + Renders a Name Info object with links to any named components. - Name Info objects are typically fields of a Type Object. - They carry information about the Symbol the type - refers to. + Name Info objects are fields of a Type Object when + they carry information about the Symbol the type + refers to, including its name. Expected Context: {Name Info Object} - Optional parameters: - nolink: If true, the name will not be linked. - Example: - {{> name-info name }} + {{> type/name-info name }} See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference --}} {{#if symbol.isImplementationDefined~}} - {{! These are special names that should not be linked. ~}} + {{! The name refers to a symbol that's implementation defined. These are special names that should not be linked. ~}} {{ str '/* '}}implementation-defined{{ str ' */'~}} {{else~}} {{#if prefix~}} - {{> symbol/name-info prefix nolink=nolink~}}:: + {{> type/name-info prefix link-components-impl=link-components-impl~}}:: {{~/if~}} {{! Render the name of the symbol. ~}} - {{#if (and symbol.url (not nolink))~}} + {{#if (and symbol.url (or link-components-impl (is_undefined link-components-impl)))~}} {{! Link to the symbol's documentation. ~}} {{#>markup/a href=symbol.url}}{{name}}{{/markup/a~}} {{else~}} @@ -32,6 +29,6 @@ {{/if~}} {{#if args~}} {{! Render the template arguments of the symbol. ~}} - {{>template/args args=args nolink=nolink~}} + {{>template/args args=args link-components-impl=link-components-impl~}} {{/if~}} {{/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs index f47aa8b71..81815f162 100644 --- a/share/mrdocs/addons/generator/html/partials/symbol.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/symbol.html.hbs @@ -86,11 +86,7 @@
{{#each (filter_by symbol.constants "isRegular" "isSeeBelow")}}