From 561f2139c4b301d3d17dce75d6e62318dbed0742 Mon Sep 17 00:00:00 2001 From: Fernando Pelliccioni Date: Thu, 30 May 2024 16:16:17 -0300 Subject: [PATCH] fix: HTML matches Asciidoc templates --- .../html/layouts/overload-set.html.hbs | 17 +++ .../html/layouts/single-symbol.html.hbs | 7 +- .../html/partials/declarator-after.html.hbs | 35 ++---- .../html/partials/declarator-before.html.hbs | 47 +++----- .../html/partials/declarator-id.html.hbs | 10 ++ .../html/partials/declarator.html.hbs | 8 +- .../generator/html/partials/enum.html.hbs | 65 ---------- .../html/partials/enumerator.html.hbs | 1 - .../generator/html/partials/field.html.hbs | 1 - .../generator/html/partials/friend.html.hbs | 1 - .../html/partials/function-sig.html.hbs | 24 ---- .../html/partials/info-list.html.hbs | 5 +- .../html/partials/info-member.html.hbs | 8 ++ .../html/partials/name-info.html.hbs | 7 ++ .../partials/nested-name-specifier.html.hbs | 14 +++ .../generator/html/partials/record.html.hbs | 46 -------- .../html/partials/signature/alias.html.hbs | 1 + .../html/partials/signature/enum.html.hbs | 2 + .../partials/signature/enumerator.html.hbs | 1 + .../html/partials/signature/field.html.hbs | 6 + .../html/partials/signature/friend.html.hbs | 5 + .../html/partials/signature/function.html.hbs | 28 +++++ .../html/partials/signature/guide.html.hbs | 8 ++ .../partials/signature/namespace.html.hbs | 1 + .../html/partials/signature/record.html.hbs | 15 +++ .../signature/specialization.html.hbs | 1 + .../html/partials/signature/typedef.html.hbs | 7 ++ .../partials/signature/undefined.html.hbs | 1 + .../html/partials/signature/using.html.hbs | 5 + .../html/partials/signature/variable.html.hbs | 11 ++ .../alias.html.hbs} | 10 +- .../html/partials/symbols/enum.html.hbs | 48 ++++++++ .../html/partials/symbols/enumerator.html.hbs | 26 ++++ .../html/partials/symbols/field.html.hbs | 26 ++++ .../html/partials/symbols/friend.html.hbs | 26 ++++ .../html/partials/symbols/function.html.hbs | 77 ++++++++++++ .../html/partials/symbols/guide.html.hbs | 26 ++++ .../html/partials/symbols/namespace.html.hbs | 9 ++ .../html/partials/symbols/record.html.hbs | 43 +++++++ .../{ => symbols}/specialization.html.hbs | 0 .../html/partials/symbols/typedef.html.hbs | 26 ++++ .../partials/{ => symbols}/undefined.html.hbs | 0 .../html/partials/symbols/using.html.hbs | 46 ++++++++ .../html/partials/symbols/variable.html.hbs | 26 ++++ .../html/partials/template-arg.html.hbs | 4 +- .../html/partials/template-args.html.hbs | 6 +- .../html/partials/template-head.html.hbs | 21 +--- .../html/partials/template-param.html.hbs | 12 ++ .../html/partials/tparam-nontype.html.hbs | 4 - .../html/partials/tparam-template.html.hbs | 5 - .../html/partials/tparam-type.html.hbs | 4 - .../generator/html/partials/tranche.html.hbs | 12 ++ .../generator/html/partials/typedef.html.hbs | 28 ----- .../generator/html/partials/variable.html.hbs | 28 ----- .../generator/html/partials/xref.html.hbs | 5 - src/lib/Gen/html/Builder.cpp | 111 +++++++++++++++--- src/lib/Gen/html/Builder.hpp | 6 + src/lib/Gen/html/SinglePageVisitor.cpp | 38 +++--- src/lib/Gen/html/SinglePageVisitor.hpp | 5 +- src/lib/Support/Handlebars.cpp | 2 + 60 files changed, 732 insertions(+), 336 deletions(-) create mode 100644 share/mrdocs/addons/generator/html/layouts/overload-set.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/declarator-id.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/enum.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/enumerator.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/field.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/friend.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/function-sig.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/info-member.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/name-info.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/nested-name-specifier.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/record.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/alias.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/enum.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/enumerator.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/field.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/friend.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/function.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/guide.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/namespace.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/record.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/specialization.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/typedef.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/undefined.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/using.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/signature/variable.html.hbs rename share/mrdocs/addons/generator/html/partials/{function.html.hbs => symbols/alias.html.hbs} (57%) create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/enum.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/enumerator.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/field.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/friend.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/function.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/guide.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/namespace.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/record.html.hbs rename share/mrdocs/addons/generator/html/partials/{ => symbols}/specialization.html.hbs (100%) create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/typedef.html.hbs rename share/mrdocs/addons/generator/html/partials/{ => symbols}/undefined.html.hbs (100%) create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/using.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/symbols/variable.html.hbs create mode 100644 share/mrdocs/addons/generator/html/partials/template-param.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/tparam-nontype.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/tparam-template.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/tparam-type.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/typedef.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/variable.html.hbs delete mode 100644 share/mrdocs/addons/generator/html/partials/xref.html.hbs diff --git a/share/mrdocs/addons/generator/html/layouts/overload-set.html.hbs b/share/mrdocs/addons/generator/html/layouts/overload-set.html.hbs new file mode 100644 index 000000000..d1ce02e7d --- /dev/null +++ b/share/mrdocs/addons/generator/html/layouts/overload-set.html.hbs @@ -0,0 +1,17 @@ +{{#if relfileprefix}}{{/if}} +
+ +

{{#if symbol.name}}Overload set {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else}}Unnamed overload set{{/if}}

+ +

Members

+ +{{#each symbol.members as |member|}} + +

{{member.doc.brief}}

+ +
{{> (concat 'signature' '/' (lookup member 'kind')) symbol=member}};
+» more... + +{{/each}} + +
diff --git a/share/mrdocs/addons/generator/html/layouts/single-symbol.html.hbs b/share/mrdocs/addons/generator/html/layouts/single-symbol.html.hbs index e3fbed5ce..b07821eca 100644 --- a/share/mrdocs/addons/generator/html/layouts/single-symbol.html.hbs +++ b/share/mrdocs/addons/generator/html/layouts/single-symbol.html.hbs @@ -1,3 +1,4 @@ -{{#with symbol}} -{{> (lookup . 'kind') symbol=.}} -{{/with}} +{{#if relfileprefix}}:relfileprefix: {{relfileprefix}}{{/if}} +[#{{#if (is_multipage)}}{{symbol.id}}{{else}}{{symbol.ref}}{{/if}}] + +{{> (concat 'symbols' '/' (lookup symbol 'kind')) symbol=symbol}} diff --git a/share/mrdocs/addons/generator/html/partials/declarator-after.html.hbs b/share/mrdocs/addons/generator/html/partials/declarator-after.html.hbs index a49ebe4df..2b2f27f95 100644 --- a/share/mrdocs/addons/generator/html/partials/declarator-after.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/declarator-after.html.hbs @@ -1,24 +1,15 @@ -{{#if (eq kind "lvalue-reference")~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}){{~/if~}} - {{~>declarator-after pointee-type~}} -{{~else if (eq kind "rvalue-reference")~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}){{~/if~}} - {{~>declarator-after pointee-type~}} -{{~else if (eq kind "pointer")~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}){{~/if~}} - {{~>declarator-after pointee-type~}} -{{~else if (eq kind "member-pointer")~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}){{~/if~}} - {{~>declarator-after pointee-type~}} -{{~else if (eq kind "array")~}} +{{#if pointee-type~}} + {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}){{/if~}} + {{~>declarator-after pointee-type nolink=nolink~}} +{{else if (eq kind "array")~}} [{{bounds-value}}] - {{~>declarator-after element-type~}} -{{~else if (eq kind "function")~}} - ({{~#each param-types~}} - {{~>declarator decl-name="" decl-name-targs=""~}}{{~#unless @last}}, {{/unless~}} - {{~/each~}}) + {{~>declarator-after element-type nolink=nolink~}} +{{else if (eq kind "function")~}} + ({{#each param-types~}} + {{~>declarator nolink=../nolink~}}{{~#unless @last}}, {{/unless~}} + {{/each~}}) {{~#if cv-qualifiers}} {{cv-qualifiers}}{{/if~}} - {{~#if (eq ref-qualifier "lvalue")}} &{{else if (eq ref-qualifier "rvalue")}} &&{{/if~}} - {{~#if exception-spec}} {{exception-spec}}{{~/if~}} - {{~>declarator-after return-type~}} -{{/if}} + {{#if (eq ref-qualifier "lvalue")}} &{{else if (eq ref-qualifier "rvalue")}} &&{{/if~}} + {{#if exception-spec}} {{exception-spec}}{{/if~}} + {{~>declarator-after return-type nolink=nolink~}} +{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/declarator-before.html.hbs b/share/mrdocs/addons/generator/html/partials/declarator-before.html.hbs index b8352a1b8..42f0a910c 100644 --- a/share/mrdocs/addons/generator/html/partials/declarator-before.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/declarator-before.html.hbs @@ -1,33 +1,16 @@ -{{#if (eq kind "builtin")~}} - {{#if cv-qualifiers}}{{cv-qualifiers}} {{/if~}} - {{name~}} -{{~else if (eq kind "tag")~}} - {{#if cv-qualifiers}}{{cv-qualifiers}} {{/if~}} - {{#if parent-type~}}{{>declarator parent-type decl-name="" decl-name-targs=""}}::{{/if~}} - {{#if symbol}}{{>xref symbol content=name}}{{else}}{{name~}}{{/if}} -{{~else if (eq kind "specialization")~}} - {{#if cv-qualifiers}}{{cv-qualifiers}} {{/if~}} - {{#if parent-type~}}{{>declarator parent-type decl-name="" decl-name-targs=""}}::{{/if~}} - {{#if symbol}}{{>xref symbol content=name}}{{else}}{{name~}}{{/if}} - {{~>template-args args=args~}} -{{~else if (eq kind "lvalue-reference")~}} - {{~>declarator-before pointee-type~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}({{~/if~}}& -{{~else if (eq kind "rvalue-reference")~}} - {{~>declarator-before pointee-type~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}({{~/if~}}&& -{{~else if (eq kind "pointer")~}} - {{~>declarator-before pointee-type~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}({{~/if~}}* - {{~#if cv-qualifiers}} {{cv-qualifiers}}{{/if~}} -{{~else if (eq kind "member-pointer")~}} - {{~>declarator-before pointee-type~}} - {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))~}}({{~/if~}} - {{#if parent-type~}}{{>declarator parent-type decl-name="" decl-name-targs=""}}::*{{/if~}} - {{#if cv-qualifiers}} {{cv-qualifiers}}{{/if~}} -{{~else if (eq kind "array")~}} - {{~>declarator-before element-type~}} -{{~else if (eq kind "function")~}} - {{~>declarator-before return-type~}} +{{#if pointee-type~}} + {{~>declarator-before pointee-type nolink=nolink~}} + {{#if (or (eq pointee-type.kind "array") (eq pointee-type.kind "function"))}}({{/if~}} +{{~/if~}} +{{#if element-type~}}{{~>declarator-before element-type nolink=nolink~}}{{/if~}} +{{#if return-type~}}{{~>declarator-before return-type nolink=nolink~}}{{/if~}} +{{#if (eq kind "lvalue-reference")}}&{{/if~}} +{{#if (eq kind "rvalue-reference")}}&&{{/if~}} +{{#if (eq kind "pointer")}}*{{/if~}} +{{#if (eq kind "member-pointer")}}{{>declarator parent-type nolink=nolink}}::*{{/if~}} +{{#if cv-qualifiers~}} + {{#if pointee-type}} {{cv-qualifiers}}{{else}}{{cv-qualifiers}} {{/if~}} {{/if~}} -{{~#if is-pack}}...{{/if~}} +{{#if (eq kind "decltype")}}decltype({{operand}}){{/if~}} +{{#if (eq kind "named")}}{{>name-info name nolink=nolink}}{{/if~}} +{{#if is-pack~}}...{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/declarator-id.html.hbs b/share/mrdocs/addons/generator/html/partials/declarator-id.html.hbs new file mode 100644 index 000000000..2d467bc3e --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/declarator-id.html.hbs @@ -0,0 +1,10 @@ +{{#if (and (eq kind "function") (eq class "conversion"))~}} + operator {{>declarator return nolink=nolink~}} +{{else if (eq kind "guide")~}} + {{>declarator deduced nolink=nolink~}} +{{else~}} + {{#if (and link.ref (not nolink))}}xref:{{link.ref}}[{{name}}]{{else}}{{name}}{{/if~}} + {{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}} + {{>template-args args=template.args nolink=nolink~}} + {{/if~}} +{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/declarator.html.hbs b/share/mrdocs/addons/generator/html/partials/declarator.html.hbs index 3f3d3fd3d..bbef8fdfe 100644 --- a/share/mrdocs/addons/generator/html/partials/declarator.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/declarator.html.hbs @@ -1,5 +1,5 @@ -{{>declarator-before~}} -{{~#if decl-name}} {{decl-name~}} -{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs}}{{~/if~}} +{{>declarator-before nolink=nolink~}} +{{~#if decl-name}} {{decl-name~}} +{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs nolink=nolink}}{{~/if~}} {{~/if~}} -{{~>declarator-after~}} \ No newline at end of file +{{~>declarator-after nolink=nolink}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/enum.html.hbs b/share/mrdocs/addons/generator/html/partials/enum.html.hbs deleted file mode 100644 index 0ed307d5f..000000000 --- a/share/mrdocs/addons/generator/html/partials/enum.html.hbs +++ /dev/null @@ -1,65 +0,0 @@ -{{!-- enum --}} -
-
-

{{symbol.name}}

- {{{symbol.doc.brief}}} -
-
-

Synopsis

-
- - enum {{name}}; - -
-
{{>source symbol.loc}}
-
- - {{#if symbol.members}} -
-

Members

-
- - - - - - - - - - - - - {{#each symbol.members}} - - - - - {{/each}} - -
NameDescription
{{name}}{{{doc.brief}}}
-
-
- {{/if}} - - {{#if symbol.doc.description}} -
-

Description

- {{{symbol.doc.description}}} -
- {{/if}} - - {{#if symbol.members}} -
- {{#each symbol.members}} - {{#if doc.description}} -
-

{{name}}

- {{{doc.description}}} -
- {{/if}} - {{/each}} -
- {{/if}} - -
diff --git a/share/mrdocs/addons/generator/html/partials/enumerator.html.hbs b/share/mrdocs/addons/generator/html/partials/enumerator.html.hbs deleted file mode 100644 index b5bd0765f..000000000 --- a/share/mrdocs/addons/generator/html/partials/enumerator.html.hbs +++ /dev/null @@ -1 +0,0 @@ -{{!-- enumerator --}} diff --git a/share/mrdocs/addons/generator/html/partials/field.html.hbs b/share/mrdocs/addons/generator/html/partials/field.html.hbs deleted file mode 100644 index f4ca36f80..000000000 --- a/share/mrdocs/addons/generator/html/partials/field.html.hbs +++ /dev/null @@ -1 +0,0 @@ -{{!-- data --}} diff --git a/share/mrdocs/addons/generator/html/partials/friend.html.hbs b/share/mrdocs/addons/generator/html/partials/friend.html.hbs deleted file mode 100644 index 8679899fb..000000000 --- a/share/mrdocs/addons/generator/html/partials/friend.html.hbs +++ /dev/null @@ -1 +0,0 @@ -{{!-- friend --}} diff --git a/share/mrdocs/addons/generator/html/partials/function-sig.html.hbs b/share/mrdocs/addons/generator/html/partials/function-sig.html.hbs deleted file mode 100644 index a5e3708a1..000000000 --- a/share/mrdocs/addons/generator/html/partials/function-sig.html.hbs +++ /dev/null @@ -1,24 +0,0 @@ -{{#if template}}{{>template-head template}}{{/if~}} -{{#if (eq storageClass "static")}}static -{{/if~}} -{{>declarator-before return}} - -{{name~}} -{{#if (eq template.kind "explicit")~}} - {{~>template-args args=template.args~}} -{{~/if~}} - -{{~#if params}} -( -{{#each params}} - {{>declarator type decl-name=name~}} - {{~#if @last}}){{else}}, - {{/if}} -{{~/each}} -{{~else~}} -() -{{~/if~}} -{{#if (eq exceptionSpec "noexcept")}} noexcept{{/if~}} -{{~>declarator-after return~}} -{{#if isDeleted}} = delete{{/if~}} -; \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/info-list.html.hbs b/share/mrdocs/addons/generator/html/partials/info-list.html.hbs index 511359c95..89a226ab4 100644 --- a/share/mrdocs/addons/generator/html/partials/info-list.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/info-list.html.hbs @@ -1,4 +1,6 @@ +{{#if members}}
+

{{title}}

@@ -11,7 +13,7 @@ - {{#each .}} + {{#each (sort_by members "name")}} @@ -20,3 +22,4 @@
{{>xref id=id content=name}} {{{doc.brief}}}
+{{/if}} diff --git a/share/mrdocs/addons/generator/html/partials/info-member.html.hbs b/share/mrdocs/addons/generator/html/partials/info-member.html.hbs new file mode 100644 index 000000000..48b587f85 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/info-member.html.hbs @@ -0,0 +1,8 @@ +¦xref:{{ref}}[`{{>declarator-id . nolink=true}}`] ¦ +{{#if (ne kind "overload")~}} + {{~doc.brief}} +{{else~}} + {{#each (unique (pluck (pluck members "doc") "brief"))~}} + {{.}} + {{/each~}} +{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/name-info.html.hbs b/share/mrdocs/addons/generator/html/partials/name-info.html.hbs new file mode 100644 index 000000000..51d6ad9cf --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/name-info.html.hbs @@ -0,0 +1,7 @@ +{{#if prefix~}} +{{#unless (or (contains @root.symbol.namespace prefix.symbol) (eq @root.symbol prefix.symbol))~}} +{{>name-info prefix nolink=nolink~}}:: +{{~/unless~}} +{{/if~}} +{{#if (and symbol.ref (not nolink))}}xref:{{symbol.ref}}[{{name}}]{{else~}} +{{name}}{{/if}}{{#if args}}{{>template-args args=args nolink=nolink}}{{/if~}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/nested-name-specifier.html.hbs b/share/mrdocs/addons/generator/html/partials/nested-name-specifier.html.hbs new file mode 100644 index 000000000..3e5e702f0 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/nested-name-specifier.html.hbs @@ -0,0 +1,14 @@ +{{#if (and symbol (or includeNamespace (ne symbol.kind "namespace")))~}} +{{#if symbol.parent~}} +{{>nested-name-specifier symbol=symbol.parent~}} +{{else~}} +{{/if~}} +{{!-- +{{#if symbol.name}} +xref:{{symbol.ref}}[{{symbol.name}}]:: +{{/if~}} +--}} +{{#if symbol.name}} +{{symbol.name}}:: +{{/if~}} +{{/if}} diff --git a/share/mrdocs/addons/generator/html/partials/record.html.hbs b/share/mrdocs/addons/generator/html/partials/record.html.hbs deleted file mode 100644 index 200d2e2a3..000000000 --- a/share/mrdocs/addons/generator/html/partials/record.html.hbs +++ /dev/null @@ -1,46 +0,0 @@ -{{!-- record --}} -
-
-

{{symbol.name}}

- {{{symbol.doc.brief}}} -
-
-

Synopsis

-
- - {{#if symbol.template}} - {{>template-head symbol.template}} - {{symbol.tag}} {{symbol.name~}} - {{#if (ne symbol.template.kind "primary")~}} - {{>template-args args=symbol.template.args}} - {{/if}} - {{else}} - {{symbol.tag}} {{symbol.name~}} - {{/if}} - {{#unless symbol.bases}} - ; - {{else}}{{"\n"}} - {{#each symbol.bases}} - {{#if @first}}:{{else}},{{/if}} - {{~#unless (eq access ../symbol.defaultAccess)}} {{access}}{{/unless}} - {{~#if isVirtual}} virtual{{/if}} - {{~null}} {{>declarator type decl-name=""}} - {{~#if @last}};{{/if}} - {{/each}} - {{/unless}} - -
-
{{>source symbol.loc}}
- {{#with symbol.interface}} - {{> tranche tranche=public label=""}} - {{> tranche tranche=protected label=" Protected"}} - {{> tranche tranche=private label=" Private"}} - {{/with}} -
- {{#if symbol.doc.description}} -
-

Description

- {{{symbol.doc.description}}} -
- {{/if}} -
diff --git a/share/mrdocs/addons/generator/html/partials/signature/alias.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/alias.html.hbs new file mode 100644 index 000000000..54204df22 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/alias.html.hbs @@ -0,0 +1 @@ +namespace {{symbol.name}} = {{>name-info symbol.aliasedSymbol}} diff --git a/share/mrdocs/addons/generator/html/partials/signature/enum.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/enum.html.hbs new file mode 100644 index 000000000..0192f2301 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/enum.html.hbs @@ -0,0 +1,2 @@ +enum {{>declarator-id symbol~}} +{{#if symbol.type}} : {{>declarator symbol.type}}{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/enumerator.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/enumerator.html.hbs new file mode 100644 index 000000000..e223c917b --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/enumerator.html.hbs @@ -0,0 +1 @@ +{{symbol.name}}{{#if symbol.initializer}} = {{symbol.initializer}}{{~/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/field.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/field.html.hbs new file mode 100644 index 000000000..be3c7facb --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/field.html.hbs @@ -0,0 +1,6 @@ +{{#if symbol.isMutable}}mutable +{{/if~}} +{{>declarator-before symbol.type}} {{>declarator-id symbol~}} +{{#if symbol.isBitfield}} : {{symbol.bitfieldWidth}}{{/if~}} +{{#if symbol.default}} = {{symbol.default}}{{/if~}} +{{>declarator-after symbol.type}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/friend.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/friend.html.hbs new file mode 100644 index 000000000..17e146df9 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/friend.html.hbs @@ -0,0 +1,5 @@ +{{#if symbol.type~}} +friend {{>declarator symbol.type~}} +{{else if symbol.symbol~}} +{{> (concat 'signature' '/' (lookup . 'symbol.symbol.kind')) symbol=symbol.symbol isFriend=true~}} +{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/function.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/function.html.hbs new file mode 100644 index 000000000..12c15eefa --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/function.html.hbs @@ -0,0 +1,28 @@ +{{#if symbol.template}}{{>template-head symbol.template}} +{{/if~}} +{{#if isFriend}}friend +{{/if~}} +{{#if symbol.constexprKind}}{{symbol.constexprKind}} +{{/if~}} +{{#if symbol.storageClass}}{{symbol.storageClass}} +{{/if~}} +{{#if symbol.isVirtual}}virtual +{{/if~}} +{{#if (eq symbol.class "normal")}}{{>declarator-before symbol.return}} +{{/if~}} +{{>declarator-id symbol link=symbol.template.primary}} +({{#if symbol.isExplicitObjectMemberFunction}}this {{/if}}{{#each symbol.params}}{{#unless (and @first @last)}} + {{/unless}}{{>declarator type decl-name=name~}} + {{#if default}} = {{default}}{{/if~}} + {{#unless @last}},{{/unless~}} +{{/each~}}) +{{~#if symbol.isConst}} const{{/if~}} +{{#if symbol.isVolatile}} volatile{{/if~}} +{{#if symbol.refQualifier}} {{symbol.refQualifier}}{{/if~}} +{{#if symbol.exceptionSpec}} {{symbol.exceptionSpec}}{{/if~}} +{{#if (eq symbol.class "normal")}}{{>declarator-after symbol.return}}{{/if~}} +{{#if symbol.hasOverrideAttr}} override{{/if~}} +{{#if symbol.isFinal}} final{{/if~}} +{{#if symbol.isPure}} = 0{{/if~}} +{{#if symbol.isDeleted}} = delete{{/if~}} +{{#if symbol.isDefaulted}} = default{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/guide.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/guide.html.hbs new file mode 100644 index 000000000..18f29d6e6 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/guide.html.hbs @@ -0,0 +1,8 @@ +{{#if symbol.template}}{{>template-head symbol.template}} +{{/if~}} +{{>declarator-id symbol}} +({{#each symbol.params}}{{#unless (and @first @last)}} + {{/unless}}{{>declarator type decl-name=name~}} + {{#if default}} = {{default}}{{/if~}} + {{#unless @last}},{{/unless~}} +{{/each~}}) -> {{>declarator symbol.deduced}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/namespace.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/namespace.html.hbs new file mode 100644 index 000000000..a58affd9f --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/namespace.html.hbs @@ -0,0 +1 @@ +{{!-- namespace --}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/record.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/record.html.hbs new file mode 100644 index 000000000..83195c9b8 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/record.html.hbs @@ -0,0 +1,15 @@ +{{#if symbol.template}}{{>template-head symbol.template}} +{{/if~}} +{{#if isFriend}}friend {{/if}}{{symbol.tag}} {{>declarator-id symbol link=symbol.template.primary~}} +{{#unless symbol.bases~}} +{{else if isFriend~}} +{{else}} + +{{#each symbol.bases~}} + {{#if @first}} + :{{else}} + ,{{/if~}} + {{#unless (eq access ../symbol.defaultAccess)}} {{access}}{{/unless~}} + {{#if isVirtual}} virtual{{/if}} {{>declarator type~}} +{{/each~}} +{{/unless}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/specialization.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/specialization.html.hbs new file mode 100644 index 000000000..f94caae56 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/specialization.html.hbs @@ -0,0 +1 @@ +{{!-- specialization --}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/typedef.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/typedef.html.hbs new file mode 100644 index 000000000..debd0e1e4 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/typedef.html.hbs @@ -0,0 +1,7 @@ +{{#if symbol.isUsing~}} + {{#if symbol.template}}{{>template-head symbol.template}} + {{/if~}} + using {{symbol.name}} = {{>declarator symbol.type}} +{{~else~}} + typedef {{>declarator symbol.type decl-name=symbol.name}} +{{~/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/undefined.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/undefined.html.hbs new file mode 100644 index 000000000..c1fbd0783 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/undefined.html.hbs @@ -0,0 +1 @@ +{{!-- undefined --}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/signature/using.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/using.html.hbs new file mode 100644 index 000000000..4258b9f63 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/using.html.hbs @@ -0,0 +1,5 @@ +{{#if (eq symbol.class "namespace")}} +using namespace {{#if symbol.qualifier}}{{>name-info symbol.qualifier}}::{{/if}}{{symbol.name}} +{{else}} +using {{#if (eq symbol.class "typename")}}typename {{/if}}{{#if (eq symbol.class "enum")}}enum {{/if}}{{#if symbol.qualifier}}{{>name-info symbol.qualifier}}::{{/if}}{{symbol.name}} +{{/if}} diff --git a/share/mrdocs/addons/generator/html/partials/signature/variable.html.hbs b/share/mrdocs/addons/generator/html/partials/signature/variable.html.hbs new file mode 100644 index 000000000..6cdcd77c9 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/signature/variable.html.hbs @@ -0,0 +1,11 @@ +{{#if symbol.template}}{{>template-head symbol.template}} +{{/if~}} +{{#if symbol.constexprKind}}{{symbol.constexprKind}} +{{/if~}} +{{#if symbol.storageClass}}{{symbol.storageClass}} +{{/if~}} +{{#if symbol.isThreadLocal}}thread_local +{{/if~}} +{{>declarator-before symbol.type}} {{>declarator-id symbol link=symbol.template.primary~}} +{{>declarator-after symbol.type~}} +{{#if symbol.initializer}} = {{symbol.initializer}}{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/function.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/alias.html.hbs similarity index 57% rename from share/mrdocs/addons/generator/html/partials/function.html.hbs rename to share/mrdocs/addons/generator/html/partials/symbols/alias.html.hbs index a34802973..e9b3545f8 100644 --- a/share/mrdocs/addons/generator/html/partials/function.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/symbols/alias.html.hbs @@ -1,17 +1,19 @@ -{{!-- function --}} +{{!-- alias --}}
-

{{symbol.name}}

+

{{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

{{{symbol.doc.brief}}}

Synopsis

- {{>function-sig symbol}} + {{>source dcl=(primary_location symbol)}}
-
{{>source symbol.loc}}
+
+            {{>signature/alias symbol=symbol}};
+        
{{#if symbol.doc.description}}
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/enum.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/enum.html.hbs new file mode 100644 index 000000000..23ba0c433 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/enum.html.hbs @@ -0,0 +1,48 @@ +{{!-- enum --}} +
+
+

{{#if symbol.name}}Enum {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else}}Unnamed enum{{/if}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/enum symbol=symbol}};
+        
+
+ + {{#if symbol.members}} +
+

Members

+ + + + + + + + + {{#each symbol.members}} + + + + + {{/each}} + +
NameDescription
{{>declarator-id . nolink=true}}{{{doc.brief}}}
+
+ {{/if}} + + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/enumerator.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/enumerator.html.hbs new file mode 100644 index 000000000..96f0c97ff --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/enumerator.html.hbs @@ -0,0 +1,26 @@ +{{!-- enumerator --}} +
+
+

Enumerator {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/enumerator symbol=symbol}}
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/field.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/field.html.hbs new file mode 100644 index 000000000..8b23f378c --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/field.html.hbs @@ -0,0 +1,26 @@ +{{!-- field --}} +
+
+

{{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/field symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/friend.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/friend.html.hbs new file mode 100644 index 000000000..262cf4a57 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/friend.html.hbs @@ -0,0 +1,26 @@ +{{!-- friend --}} +
+
+

Friend {{#if symbol.symbol}}{{symbol.symbol.name}}{{else}}{{symbol.type.name}}{{/if}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/friend symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/function.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/function.html.hbs new file mode 100644 index 000000000..be1b8cf4a --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/function.html.hbs @@ -0,0 +1,77 @@ +{{!-- function --}} +
+
+

Function {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/function symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} + + {{#if symbol.doc.exceptions}} +
+

Exceptions

+ + + + + + + + + {{#each symbol.doc.exceptions}} + + + + + {{/each}} + +
NameThrown on
{{exception}}{{description}}
+
+ {{/if}} + + {{#if symbol.doc.returns}} +
+

Return Value

+ {{{symbol.doc.returns}}} +
+ {{/if}} + + {{#if symbol.doc.params}} +
+

Parameters

+ + + + + + + + + {{#each symbol.doc.params}} + + + + + {{/each}} + +
NameDescription
{{name}}{{description}}
+
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/guide.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/guide.html.hbs new file mode 100644 index 000000000..c856d68b7 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/guide.html.hbs @@ -0,0 +1,26 @@ +{{!-- guides --}} +
+
+

Deduction guide {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/guide symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/namespace.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/namespace.html.hbs new file mode 100644 index 000000000..3f99d3460 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/namespace.html.hbs @@ -0,0 +1,9 @@ +{{!-- namespace --}} +
+
+

{{#if symbol.name}}Namespace {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else if symbol.parent}}Unnamed namespace{{else}}Global namespace{{/if}}

+
+
+ {{> tranche tranche=symbol.interface label="" is-namespace=true}} +
+
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/record.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/record.html.hbs new file mode 100644 index 000000000..eb4e79659 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/record.html.hbs @@ -0,0 +1,43 @@ +{{!-- record --}} +
+
+

{{#if symbol.name}}Class {{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else}}Unnamed class{{/if}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/record symbol=symbol}};
+        
+
+ + {{#with symbol.interface}} +
+ {{> tranche tranche=public label="" is-namespace=false}} + {{> tranche tranche=protected label="Protected" is-namespace=false}} + {{> tranche tranche=private label="Private" is-namespace=false}} +
+ {{/with}} + + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} + + {{#if symbol.doc.see}} +
+

See Also

+ {{#each symbol.doc.see}} +

{{.}}

+ {{/each}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/specialization.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/specialization.html.hbs similarity index 100% rename from share/mrdocs/addons/generator/html/partials/specialization.html.hbs rename to share/mrdocs/addons/generator/html/partials/symbols/specialization.html.hbs diff --git a/share/mrdocs/addons/generator/html/partials/symbols/typedef.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/typedef.html.hbs new file mode 100644 index 000000000..306eb66ef --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/typedef.html.hbs @@ -0,0 +1,26 @@ +{{!-- typedef --}} +
+
+

{{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/typedef symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/undefined.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/undefined.html.hbs similarity index 100% rename from share/mrdocs/addons/generator/html/partials/undefined.html.hbs rename to share/mrdocs/addons/generator/html/partials/symbols/undefined.html.hbs diff --git a/share/mrdocs/addons/generator/html/partials/symbols/using.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/using.html.hbs new file mode 100644 index 000000000..ed8fe5d7b --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/using.html.hbs @@ -0,0 +1,46 @@ +{{!-- symbols/using.html.hbs --}} +
+
+

Using {{#if (eq symbol.class "namespace")}}Directive: {{symbol.qualifier.name}}{{else}}Declaration: {{symbol.name}}{{/if}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/using symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} + + {{#unless (eq symbol.class "namespace")}} +
+

Introduced Symbols

+ + + + + + + + {{#each symbol.symbols}} + + + + {{/each}} + +
Name
{{name}}
+
+ {{/unless}} +
diff --git a/share/mrdocs/addons/generator/html/partials/symbols/variable.html.hbs b/share/mrdocs/addons/generator/html/partials/symbols/variable.html.hbs new file mode 100644 index 000000000..7c986d2f8 --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/symbols/variable.html.hbs @@ -0,0 +1,26 @@ +{{!-- variable --}} +
+
+

{{>nested-name-specifier symbol=symbol.parent}}{{symbol.name}}

+ {{{symbol.doc.brief}}} +
+ +
+

Synopsis

+
+ + {{>source dcl=(primary_location symbol)}} + +
+
+            {{>signature/variable symbol=symbol}};
+        
+
+ + {{#if symbol.doc.description}} +
+

Description

+ {{{symbol.doc.description}}} +
+ {{/if}} +
diff --git a/share/mrdocs/addons/generator/html/partials/template-arg.html.hbs b/share/mrdocs/addons/generator/html/partials/template-arg.html.hbs index 85f6d1438..130b144a0 100644 --- a/share/mrdocs/addons/generator/html/partials/template-arg.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/template-arg.html.hbs @@ -1,8 +1,8 @@ {{#if (eq kind "type")~}} -{{~>declarator type decl-name=""~}} +{{~>declarator type nolink=nolink~}} {{else if (eq kind "non-type")~}} {{~value~}} {{else if (eq kind "template")~}} -{{#if template}}{{>xref id=template content=name~}}{{else~}}{{name~}}{{/if~}} +{{#if (and template (not nolink))}}xref:{{template.ref}}[{{name~}}]{{else~}}{{name~}}{{/if~}} {{/if~}} {{~#if is-pack}}...{{/if~}} diff --git a/share/mrdocs/addons/generator/html/partials/template-args.html.hbs b/share/mrdocs/addons/generator/html/partials/template-args.html.hbs index cfd79aff8..4a86d8c00 100644 --- a/share/mrdocs/addons/generator/html/partials/template-args.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/template-args.html.hbs @@ -1,4 +1,4 @@ -<{{~#each args~}} -{{~>template-arg .~}} +<{{~#each args~}} +{{~>template-arg nolink=../nolink~}} {{~#if (not @last)}}, {{/if~}} -{{~/each~}}> \ No newline at end of file +{{~/each~}}> \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/template-head.html.hbs b/share/mrdocs/addons/generator/html/partials/template-head.html.hbs index 17d14c785..2774ceeb5 100644 --- a/share/mrdocs/addons/generator/html/partials/template-head.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/template-head.html.hbs @@ -1,17 +1,4 @@ -{{#if params~}} -template< -{{#each params}} - {{#if (eq kind "type")}} - {{>tparam-type~}} - {{else if (eq kind "non-type")}} - {{>tparam-nontype~}} - {{else if (eq kind "template")}} - {{>tparam-template~}} - {{/if}} - {{~#unless @last}}, - {{else}} - {{/unless}} -{{/each}}> -{{else~}} -template<> -{{/if}} +template<{{#each params}}{{#unless (and @first @last)}} + {{/unless}}{{>template-param~}} + {{#unless @last}},{{/unless~}} +{{/each~}}> \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/template-param.html.hbs b/share/mrdocs/addons/generator/html/partials/template-param.html.hbs new file mode 100644 index 000000000..6afd331ff --- /dev/null +++ b/share/mrdocs/addons/generator/html/partials/template-param.html.hbs @@ -0,0 +1,12 @@ +{{#if (eq kind "type")~}} + {{key}}{{#if is-pack}}...{{/if~}} + {{#if name}} {{name}}{{/if~}} + {{#if default}} = {{>template-arg default~}}{{/if~}} +{{else if (eq kind "non-type")~}} + {{>declarator type decl-name=name}}{{#if is-pack}}...{{/if~}} + {{#if default}} = {{>template-arg default~}}{{/if~}} +{{else if (eq kind "template")~}} + {{>template-head}} typename{{#if is-pack}}...{{/if~}} + {{#if name}} {{name}}{{/if~}} + {{#if default}} = {{>template-arg default~}}{{/if~}} +{{/if}} \ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/tparam-nontype.html.hbs b/share/mrdocs/addons/generator/html/partials/tparam-nontype.html.hbs deleted file mode 100644 index a42f8c188..000000000 --- a/share/mrdocs/addons/generator/html/partials/tparam-nontype.html.hbs +++ /dev/null @@ -1,4 +0,0 @@ -{{>declarator type decl-name=""}} -{{~#if is-pack}}...{{/if}} -{{~#if name}} {{name}}{{/if}} -{{~#if default}} = {{>template-arg default~}}{{/if~}} diff --git a/share/mrdocs/addons/generator/html/partials/tparam-template.html.hbs b/share/mrdocs/addons/generator/html/partials/tparam-template.html.hbs deleted file mode 100644 index 385684173..000000000 --- a/share/mrdocs/addons/generator/html/partials/tparam-template.html.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{~>template-head~}} -typename -{{~#if is-pack}}...{{/if}} -{{~#if name}} {{name}}{{/if}} -{{~#if default}} = {{>template-arg default~}}{{/if~}} diff --git a/share/mrdocs/addons/generator/html/partials/tparam-type.html.hbs b/share/mrdocs/addons/generator/html/partials/tparam-type.html.hbs deleted file mode 100644 index 0cc149c17..000000000 --- a/share/mrdocs/addons/generator/html/partials/tparam-type.html.hbs +++ /dev/null @@ -1,4 +0,0 @@ -{{key}} -{{~#if is-pack}}...{{/if}} -{{~#if name}} {{name}}{{/if}} -{{~#if default}} = {{>template-arg default~}}{{~/if~}} diff --git a/share/mrdocs/addons/generator/html/partials/tranche.html.hbs b/share/mrdocs/addons/generator/html/partials/tranche.html.hbs index ae890861c..9b2bfd2cb 100644 --- a/share/mrdocs/addons/generator/html/partials/tranche.html.hbs +++ b/share/mrdocs/addons/generator/html/partials/tranche.html.hbs @@ -44,3 +44,15 @@ {{>info-list tranche.staticdata}}
{{/if}} +{{#if tranche.aliases}} +
+

{{label}} Aliases

+ {{>info-list tranche.aliases}} +
+{{/if}} +{{#if tranche.usings}} +
+

{{label}} Usings Declarations/Directives

+ {{>info-list tranche.usings}} +
+{{/if}} diff --git a/share/mrdocs/addons/generator/html/partials/typedef.html.hbs b/share/mrdocs/addons/generator/html/partials/typedef.html.hbs deleted file mode 100644 index 6c925785f..000000000 --- a/share/mrdocs/addons/generator/html/partials/typedef.html.hbs +++ /dev/null @@ -1,28 +0,0 @@ -{{!-- typedef --}} -
-
-

{{symbol.name}}

- {{{symbol.doc.brief}}} -
-
-

Synopsis

-
- - {{#if symbol.isUsing~}} - {{~#if symbol.template}}{{>template-head symbol.template}}{{/if~}} - using {{symbol.name}} = {{>declarator symbol.type}} - {{~else~}} - typedef {{>declarator symbol.type decl-name=symbol.name}} - {{~/if}} - ; - -
-
{{>source symbol.loc}}
-
- {{#if symbol.doc.description}} -
-

Description

- {{{symbol.doc.description}}} -
- {{/if}} -
diff --git a/share/mrdocs/addons/generator/html/partials/variable.html.hbs b/share/mrdocs/addons/generator/html/partials/variable.html.hbs deleted file mode 100644 index fe1ed54c6..000000000 --- a/share/mrdocs/addons/generator/html/partials/variable.html.hbs +++ /dev/null @@ -1,28 +0,0 @@ -{{!-- variable --}} -
-
-

{{symbol.name}}

- {{{symbol.doc.brief}}} -
-
-

Synopsis

-
- - {{#if symbol.template}}{{>template-head symbol.template}}{{/if~}} - {{#if (or (eq symbol.template.kind "explicit") (eq symbol.template.kind "partial"))~}} - {{~>declarator symbol.type decl-name=symbol.name decl-name-targs=symbol.template.args~}} - {{~else~}} - {{~>declarator symbol.type decl-name=symbol.name decl-name-targs=""~}} - {{~/if}} - ; - -
-
{{>source symbol.loc}}
-
- {{#if symbol.doc.description}} -
-

Description

- {{{symbol.doc.description}}} -
- {{/if}} -
\ No newline at end of file diff --git a/share/mrdocs/addons/generator/html/partials/xref.html.hbs b/share/mrdocs/addons/generator/html/partials/xref.html.hbs deleted file mode 100644 index 997f9c32a..000000000 --- a/share/mrdocs/addons/generator/html/partials/xref.html.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{#if (is_multipage)~}} -{{content}} -{{~else~}} -{{content}} -{{~/if}} \ No newline at end of file diff --git a/src/lib/Gen/html/Builder.cpp b/src/lib/Gen/html/Builder.cpp index 7117349ab..6d6f23b8d 100644 --- a/src/lib/Gen/html/Builder.cpp +++ b/src/lib/Gen/html/Builder.cpp @@ -42,22 +42,22 @@ Builder( std::string partialsPath = files::appendPath( config->addonsDir, "generator", "html", "partials"); forEachFile(partialsPath, true, - [&](std::string_view pathName) -> Error - { - fs::path path = pathName; - if(path.extension() != ".hbs") + [&](std::string_view pathName) -> Error + { + fs::path path = pathName; + if(path.extension() != ".hbs") + return Error::success(); + path = path.lexically_relative(partialsPath); + while(path.has_extension()) + path.replace_extension(); + + auto text = files::getFileText(pathName); + if (! text) + return text.error(); + + hbs_.registerPartial( + path.generic_string(), *text); return Error::success(); - path = path.lexically_relative(partialsPath); - while(path.has_extension()) - path.replace_extension(); - - auto text = files::getFileText(pathName); - if (! text) - return text.error(); - - hbs_.registerPartial( - path.generic_string(), *text); - return Error::success(); }).maybeThrow(); // Load JavaScript helpers @@ -68,8 +68,7 @@ Builder( { // Register JS helper function in the global object constexpr std::string_view ext = ".js"; - if (!pathName.ends_with(ext)) - return {}; + if (!pathName.ends_with(ext)) return {}; auto name = files::getFileName(pathName); name.remove_suffix(ext.size()); MRDOCS_TRY(auto script, files::getFileText(pathName)); @@ -82,7 +81,47 @@ Builder( dom::makeInvocable([res = config->multiPage]() -> Expected { return res; })); + + hbs_.registerHelper("primary_location", + dom::makeInvocable([](dom::Value const& v) -> + dom::Value + { + dom::Value src_loc = v.get("loc"); + if(! src_loc) + return nullptr; + dom::Value decls = src_loc.get("decl"); + if(dom::Value def = src_loc.get("def")) + { + // for classes/enums, prefer the definition + dom::Value kind = v.get("kind"); + if(kind == "record" || kind == "enum") + return def; + + // we only every want to use the definition + // for non-tag types when no other declaration + // exists + if(! decls) + return def; + } + if(! decls.isArray()) + return nullptr; + dom::Value first; + // otherwise, use whatever declaration had docs. + // if no declaration had docs, fallback to the + // first declaration + for(const dom::Value& loc : decls.getArray()) + { + if(loc.get("documented")) + return loc; + else if(! first) + first = loc; + } + return first; + })); + + helpers::registerStringHelpers(hbs_); helpers::registerAntoraHelpers(hbs_); + helpers::registerContainerHelpers(hbs_); } //------------------------------------------------ @@ -105,7 +144,6 @@ callTemplate( MRDOCS_TRY(auto fileText, files::getFileText(pathName)); HandlebarsOptions options; options.noEscape = true; - Expected exp = hbs_.try_render(fileText, context, options); if (!exp) @@ -131,6 +169,20 @@ renderSinglePageFooter() //------------------------------------------------ +std::string +Builder:: +getRelPrefix(std::size_t depth) +{ + std::string rel_prefix; + if(! depth ||! domCorpus_->config->multiPage) + return rel_prefix; + --depth; + rel_prefix.reserve(depth * 3); + while(depth--) + rel_prefix.append("../"); + return rel_prefix; +} + dom::Value Builder:: createContext( @@ -141,6 +193,20 @@ createContext( }); } +dom::Value +Builder:: +createContext( + OverloadSet const& OS) +{ + dom::Object::storage_type props; + props.emplace_back("symbol", + domCorpus_.getOverloads(OS)); + const Info& Parent = domCorpus_->get(OS.Parent); + props.emplace_back("relfileprefix", + getRelPrefix(Parent.Namespace.size() + 1)); + return dom::Object(std::move(props)); +} + template Expected Builder:: @@ -151,6 +217,15 @@ operator()(T const& I) createContext(I.id)); } +Expected +Builder:: +operator()(OverloadSet const& OS) +{ + return callTemplate( + "overload-set.html.hbs", + createContext(OS)); +} + #define DEFINE(T) template Expected \ Builder::operator()(T const&) diff --git a/src/lib/Gen/html/Builder.hpp b/src/lib/Gen/html/Builder.hpp index b04d1f2cf..d12c3efb9 100644 --- a/src/lib/Gen/html/Builder.hpp +++ b/src/lib/Gen/html/Builder.hpp @@ -36,12 +36,15 @@ class Builder js::Context ctx_; Handlebars hbs_; + std::string getRelPrefix(std::size_t depth); + public: Builder( DomCorpus const& domCorpus, Options const& options); dom::Value createContext(SymbolID const& id); + dom::Value createContext(OverloadSet const& OS); Expected callTemplate( @@ -54,6 +57,9 @@ class Builder template Expected operator()(T const&); + + Expected + operator()(OverloadSet const& OS); }; } // html diff --git a/src/lib/Gen/html/SinglePageVisitor.cpp b/src/lib/Gen/html/SinglePageVisitor.cpp index 4242bb516..113f65c9a 100644 --- a/src/lib/Gen/html/SinglePageVisitor.cpp +++ b/src/lib/Gen/html/SinglePageVisitor.cpp @@ -20,35 +20,41 @@ void SinglePageVisitor:: operator()(T const& I) { - renderPage(I, numPages_++); + ex_.async([this, &I, page = numPages_++](Builder& builder) + { + if(auto r = builder(I)) + writePage(*r, page); + else + r.error().Throw(); + }); if constexpr( T::isNamespace() || T::isRecord() || - T::isEnum() || - T::isSpecialization()) - corpus_.traverse(I, *this); + T::isEnum()) + { + // corpus_.traverse(I, *this); + corpus_.traverseOverloads(I, *this); + } } -// Launch a task to render the page -// pageNumber is zero-based -// void SinglePageVisitor:: -renderPage( - auto const& I, - std::size_t pageNumber) +operator()(OverloadSet const& OS) { - ex_.async( - [this, &I, pageNumber](Builder& builder) - { - endPage(builder(I).value(), pageNumber); - }); + ex_.async([this, OS, page = numPages_++](Builder& builder) + { + if(auto r = builder(OS)) + writePage(*r, page); + else + r.error().Throw(); + corpus_.traverse(OS, *this); + }); } // pageNumber is zero-based void SinglePageVisitor:: -endPage( +writePage( std::string pageText, std::size_t pageNumber) { diff --git a/src/lib/Gen/html/SinglePageVisitor.hpp b/src/lib/Gen/html/SinglePageVisitor.hpp index ccf3dc276..e153dbe70 100644 --- a/src/lib/Gen/html/SinglePageVisitor.hpp +++ b/src/lib/Gen/html/SinglePageVisitor.hpp @@ -29,7 +29,7 @@ class SinglePageVisitor ExecutorGroup& ex_; Corpus const& corpus_; std::ostream& os_; - std::size_t numPages_ = 0; + std::size_t numPages_ = 0; std::mutex mutex_; std::size_t topPage_ = 0; std::vector void operator()(T const& I); + void operator()(OverloadSet const& OS); void renderPage(auto const& I, std::size_t pageNumber); - void endPage(std::string pageText, std::size_t pageNumber); + void writePage(std::string pageText, std::size_t pageNumber); }; } // html diff --git a/src/lib/Support/Handlebars.cpp b/src/lib/Support/Handlebars.cpp index 9a15225e9..bb30434ef 100644 --- a/src/lib/Support/Handlebars.cpp +++ b/src/lib/Support/Handlebars.cpp @@ -3678,6 +3678,7 @@ bool and_fn(dom::Array const& args) { std::size_t const n = args.size(); + if (n == 0) return true; for (std::size_t i = 0; i < n - 1; ++i) { if (!args.get(i)) @@ -3691,6 +3692,7 @@ and_fn(dom::Array const& args) bool or_fn(dom::Array const& args) { std::size_t const n = args.size(); + if (n == 0) return false; for (std::size_t i = 0; i < n - 1; ++i) { if (args.get(i))