Skip to content

Commit

Permalink
feat: HTML generator
Browse files Browse the repository at this point in the history
  • Loading branch information
sdkrystian authored and vinniefalco committed Jul 17, 2023
1 parent 534e3bb commit a57def6
Show file tree
Hide file tree
Showing 42 changed files with 1,793 additions and 1 deletion.
9 changes: 9 additions & 0 deletions addons/generator/html/layouts/page.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
</html>
<head></head>
<body>
<div>
<h1>Reference</h1>
{{>symbol}}
</div>
</body>
</html>
4 changes: 4 additions & 0 deletions addons/generator/html/layouts/single-footer.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
</div>
<div><h4>Created with MrDox</h4></div>
</body>
</html>
5 changes: 5 additions & 0 deletions addons/generator/html/layouts/single-header.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
</html>
<head></head>
<body>
<div>
<h1>Reference</h1>
3 changes: 3 additions & 0 deletions addons/generator/html/layouts/single-symbol.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#with symbol}}
{{> (lookup . 'kind') symbol=.}}
{{/with}}
26 changes: 26 additions & 0 deletions addons/generator/html/partials/declarator-after.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{#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 "pack")~}}
{{~>declarator-after pattern-type~}}
{{~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~}})
{{~#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}}
34 changes: 34 additions & 0 deletions addons/generator/html/partials/declarator-before.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{#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 id}}{{>xref id=id 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 id}}{{>xref id=id content=name}}{{else}}{{name~}}{{/if}}
{{~>template-args args=template-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 "pack")~}}
{{~>declarator-before pattern-type~}}...
{{~else if (eq kind "array")~}}
{{~>declarator-before element-type~}}
{{~else if (eq kind "function")~}}
{{~>declarator-before return-type~}}
{{/if}}
5 changes: 5 additions & 0 deletions addons/generator/html/partials/declarator.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<span class="declarator">{{>declarator-before~}}
{{~#if decl-name}} <span class="declarator-name">{{decl-name~}}</span>
{{~#if decl-name-targs~}}{{>template-args args=decl-name-targs}}{{~/if~}}
{{~/if~}}
{{~>declarator-after~}}</span>
65 changes: 65 additions & 0 deletions addons/generator/html/partials/enum.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{!-- enum --}}
<div id="{{symbol.id}}">
<div>
<h2>{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
</div>
<div>
<h3>Synopsis</h3>
<div>
<code>
enum {{name}};
</code>
</div>
<div>{{>source symbol.loc}}</div>
</div>

{{#if symbol.members}}
<div>
<h3>Members</h3>
<div>
<table>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{{#each symbol.members}}
<tr>
<td>{{name}}</td>
<td>{{{doc.brief}}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
{{/if}}

{{#if symbol.doc.description}}
<div>
<h3>Description</h3>
{{{symbol.doc.description}}}
</div>
{{/if}}

{{#if symbol.members}}
<div>
{{#each symbol.members}}
{{#if doc.description}}
<div>
<h4>{{name}}</h4>
{{{doc.description}}}
</div>
{{/if}}
{{/each}}
</div>
{{/if}}

</div>
1 change: 1 addition & 0 deletions addons/generator/html/partials/field.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{!-- data --}}
24 changes: 24 additions & 0 deletions addons/generator/html/partials/function-sig.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{#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~}}
;
22 changes: 22 additions & 0 deletions addons/generator/html/partials/function.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{!-- function --}}
<div id="{{symbol.id}}">
<div>
<h2>{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
</div>
<div>
<h3>Synopsis</h3>
<div>
<code>
{{>function-sig symbol}}
</code>
</div>
<div>{{>source symbol.loc}}</div>
</div>
{{#if symbol.doc.description}}
<div>
<h3>Description</h3>
{{{symbol.doc.description}}}
</div>
{{/if}}
</div>
22 changes: 22 additions & 0 deletions addons/generator/html/partials/info-list.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div>
<table>
<colgroup>
<col style="width: 50%;">
<col style="width: 50%;">
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{{#each .}}
<tr>
<td>{{>xref id=id content=name}}</td>
<td>{{{doc.brief}}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
9 changes: 9 additions & 0 deletions addons/generator/html/partials/namespace.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{!-- namespace --}}
<div id="{{symbol.id}}">
<div>
<h2>Namespace {{symbol.name}}</h2>
{{{symbol.doc.brief}}}
</div>

{{>info-list symbol.members}}
</div>
46 changes: 46 additions & 0 deletions addons/generator/html/partials/record.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{!-- record --}}
<div id="{{symbol.id}}">
<div>
<h2>{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
</div>
<div>
<h3>Synopsis</h3>
<div>
<code>
{{#if symbol.template}}
{{>template-head symbol.template}}
{{symbol.tag}} {{symbol.name~}}
{{#if (neq 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}}
</code>
</div>
<div>{{>source symbol.loc}}</div>
{{#with symbol.interface}}
{{> tranche tranche=public label=""}}
{{> tranche tranche=protected label=" Protected"}}
{{> tranche tranche=private label=" Private"}}
{{/with}}
</div>
{{#if symbol.doc.description}}
<div>
<h3>Description</h3>
{{{symbol.doc.description}}}
</div>
{{/if}}
</div>
12 changes: 12 additions & 0 deletions addons/generator/html/partials/source.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{#if def}}
<p>
<span>Declared in file &lt;{{def.file}}&gt; at line {{def.line}}</span>
</p>
{{else if decl}}
<p>
{{#each decl}}
<span>Declared in file &lt;{{file}}&gt; at line {{line}}</span>
{{/each}}
</p>
{{else}}
{{/if}}
1 change: 1 addition & 0 deletions addons/generator/html/partials/specialization.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{!-- specialization --}}
8 changes: 8 additions & 0 deletions addons/generator/html/partials/template-arg.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{#if (eq kind "type")~}}
{{~>declarator type decl-name=""~}}
{{else if (eq kind "non-type")~}}
{{~value~}}
{{else if (eq kind "template")~}}
{{#if template}}{{>xref id=template content=name~}}{{else~}}{{name~}}{{/if~}}
{{/if~}}
{{~#if is-pack}}...{{/if~}}
4 changes: 4 additions & 0 deletions addons/generator/html/partials/template-args.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
&lt;{{~#each args~}}
{{~>template-arg .~}}
{{~#if (not @last)}}, {{/if~}}
{{~/each~}}&gt;
17 changes: 17 additions & 0 deletions addons/generator/html/partials/template-head.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{#if params~}}
template&lt;
{{#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}}&gt;
{{else~}}
template&lt;&gt;
{{/if}}
4 changes: 4 additions & 0 deletions addons/generator/html/partials/tparam-nontype.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{>declarator type decl-name=""}}
{{~#if is-pack}}...{{/if}}
{{~#if name}} {{name}}{{/if}}
{{~#if default}} = {{>template-arg default~}}{{/if~}}
5 changes: 5 additions & 0 deletions addons/generator/html/partials/tparam-template.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{~>template-head~}}
typename
{{~#if is-pack}}...{{/if}}
{{~#if name}} {{name}}{{/if}}
{{~#if default}} = {{>template-arg default~}}{{/if~}}
4 changes: 4 additions & 0 deletions addons/generator/html/partials/tparam-type.html.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{key}}
{{~#if is-pack}}...{{/if}}
{{~#if name}} {{name}}{{/if}}
{{~#if default}} = {{>template-arg default~}}{{~/if~}}
Loading

0 comments on commit a57def6

Please sign in to comment.