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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions docs/modules/ROOT/pages/generators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,10 @@ The top-level object in the DOM is the context for a template.The top-level obje
|`<<symbol-fields,Symbol Object>>`
|The symbol being rendered.

|`relfileprefix`
|`string`
|The relative file prefix for the output file.

|`config`
|`<<config-fields,Config Object>>`
|The configuration object.

|`sectionref`
|`string`
|The section reference.
|===

[#symbol-fields]
Expand Down Expand Up @@ -138,6 +131,21 @@ The `Symbol` object represents a symbol extracted from the source code.The symbo

|===

Handlebars generators extend each symbol with the following fields:

|===
|Property |Type| Description

| `url`
| `string`
| The URL of the symbol. If the documentation is a single page, this is the anchor link to the symbol starting with `#`. If the documentation is multipage, this is the path to the symbol starting with `/`.

| `anchor`
| `string`
| The anchor link to the symbol. This is used for section IDs in the documentation.

|===

The `Symbol` object has additional properties based on the kind of symbol. The following table lists the additional properties for symbols that contain information about their scope (such as Namespaces and Classes):

|===
Expand Down
25 changes: 12 additions & 13 deletions include/mrdocs/Metadata/DomCorpus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ class MRDOCS_DECL
dom::Object
construct(Info const& I) const;

/** Return a Dom value representing an overload set.

A @ref Generator should override this member
and return suitable @ref dom::Value representing
the overload set.
*/
virtual
dom::Object
construct(
OverloadSet const& os) const;

/** Return a Dom object representing the given symbol.

@return A value containing the symbol
Expand All @@ -103,19 +114,7 @@ class MRDOCS_DECL
*/
virtual
dom::Value
getJavadoc(
Javadoc const& jd) const;

/** Return a Dom value representing an overload set.

A @ref Generator should override this member
and return suitable @ref dom::Value representing
the overload set.
*/
virtual
dom::Object
getOverloads(
OverloadSet const& os) const;
getJavadoc(Javadoc const& jd) const;
};

} // mrdocs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{! A page when the symbol type is "overloads" }}
{{#if relfileprefix}}:relfileprefix: {{relfileprefix}}{{/if}}
[#{{sectionref}}]

[#{{symbol.anchor}}]
={{#unless @root.config.multipage}}={{/unless}} {{#if symbol.name}}{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}{{else}}Unnamed overload set{{/if}}

{{#if symbol.members.[0]}}
Expand Down
3 changes: 0 additions & 3 deletions share/mrdocs/addons/generator/adoc/layouts/index.adoc.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
{{! The section with a symbol in single page output or the symbol page in multi page output }}
{{#if relfileprefix}}:relfileprefix: {{relfileprefix}}{{/if}}

[#{{{sectionref}}}]
{{> symbol symbol=symbol}}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
xref:{{{href}}}[{{> @partial-block }}]
{{#if (starts_with href "#")}}<<{{{href}}},{{> @partial-block }}>>{{else}}xref:{{{href}}}[{{> @partial-block }}]{{/if}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- alias --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- concept --}}
[#{{{symbol.anchor}}}]
= {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- enum --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{#if symbol.name}}{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}{{else}}Unnamed enum{{/if}}

{{{symbol.doc.brief}}}
Expand All @@ -18,7 +19,7 @@
|===
|Name |Description
{{#each symbol.members}}
|xref:{{{ref}}}[`pass:v[{{>types/declarator-id . nolink=true}}]`] | {{~doc.brief}}
|xref:{{{anchor}}}[`pass:v[{{>types/declarator-id . nolink=true}}]`] | {{~doc.brief}}
{{/each}}
|===
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- enumerator --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- field --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- friend --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{#if symbol.symbol}}{{>types/nested-name-specifier symbol=symbol.symbol.parent includeNamespace=true}}{{symbol.symbol.name}}{{else}}{{symbol.type.name}}{{/if}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- function --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- guides --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- namespace --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{#if symbol.name}}{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}{{else if symbol.parent}}Unnamed namespace{{else}}Global namespace{{/if}}

{{>types/tranche tranche=symbol.interface label="" is-namespace=true}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- record --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{#if symbol.name}}{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}{{else}}Unnamed class{{/if}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- typedef --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
{{!-- undefined --}}
[#{{{symbol.anchor}}}]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- symbols/using.adoc.hbs --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{!-- variable --}}
[#{{{symbol.anchor}}}]
={{#unless @root.config.multipage}}={{/unless}} {{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}

{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{else if (eq kind "guide")~}}
{{>types/declarator deduced nolink=nolink~}}
{{else~}}
{{#if (and link.ref (not nolink))}}{{#>markup/a href=link.ref}}{{name}}{{/markup/a}}{{else}}{{name}}{{/if~}}
{{#if (and link.url (not nolink))}}{{#>markup/a href=(relativize link.url)}}{{name}}{{/markup/a}}{{else}}{{name}}{{/if~}}
{{#if (or (eq template.kind "explicit") (eq template.kind "partial"))~}}
{{>types/template-args args=template.args nolink=nolink~}}
{{/if~}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{! Helper for "info-list": renders a symbol as a row in a table of members }}
{{#>markup/tr~}}
{{#>markup/td~}}
{{#>markup/a href=ref}}{{#>markup/code}}{{>types/declarator-id . nolink=true}}{{/markup/code}}{{/markup/a}} {{>types/special-name-suffix .}}
{{#>markup/a href=(relativize url)}}{{#>markup/code}}{{>types/declarator-id . nolink=true}}{{/markup/code}}{{/markup/a}} {{>types/special-name-suffix .}}
{{~/markup/td}}
{{#>markup/td~}}
{{#if (ne kind "overload")~}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
{{>types/name-info prefix nolink=nolink~}}::
{{~/if~}}
{{#if (or (eq name "see-below") (eq name "implementation-defined"))~}}{{ str '_'}}{{name}}{{ str '_'}}{{else~}}
{{#if (and symbol.ref (not nolink))}}{{#>markup/a href=symbol.ref}}{{name}}{{/markup/a}}{{else~}}
{{#if (and symbol.url (not nolink))}}{{#>markup/a href=(relativize symbol.url)}}{{name}}{{/markup/a}}{{else~}}
{{name}}{{/if}}{{#if args}}{{>types/template-args args=args nolink=nolink}}{{/if~}}{{/if~}}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
{{>types/qualified-path symbol=symbol.parent nolink=nolink~}}
{{else~}}
{{/if~}}
{{#if symbol.name}}{{#if (not nolink)}}{{#>markup/a href=symbol.ref}}{{symbol.name}}{{/markup/a}}{{else}}{{symbol.name}}{{/if}}::{{/if~}}
{{#if symbol.name}}{{#if (not nolink)}}{{#>markup/a href=(relativize symbol.url)}}{{symbol.name}}{{/markup/a}}{{else}}{{symbol.name}}{{/if}}::{{/if~}}
{{/unless}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{{ str "<" }}{{#unless (and @root.config.base-url (eq dcl.kind "source"))~}}
{{dcl.file}}
{{~else~}}
{{#>markup/a href=(concat @root.config.base-url dcl.file '#L' dcl.line)}}{{dcl.file}}{{/markup/a}}>
{{#>markup/a href=(concat @root.config.base-url dcl.file '#L' dcl.line)}}{{dcl.file}}{{/markup/a}}
{{~/unless~}}{{ str ">" }}
{{~/markup/code}}
{{~/markup/span}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
{{else if (eq kind "non-type")~}}
{{~value~}}
{{else if (eq kind "template")~}}
{{#if (and template (not nolink))}}xref:{{template.ref}}[{{name~}}]{{else~}}{{name~}}{{/if~}}
{{#if (and template (not nolink))}}{{#>markup/a href=(relativize template.url)}}{{name}}{{/markup/a}}{{else~}}{{name~}}{{/if~}}
{{/if~}}
{{~#if is-pack}}...{{/if~}}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{! A page when the symbol type is "overloads" }}
{{#if relfileprefix}}<meta name="relfileprefix" content="{{relfileprefix}}">{{/if}}
<div id="{{#if @root.config.multipage}}{{symbol.id}}{{else}}{{symbol.ref}}{{/if}}">
<div id="{{{symbol.anchor}}}">

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

Expand All @@ -11,7 +10,7 @@
<p>{{member.doc.brief}}</p>

<pre><code class="language-cpp">{{> (concat 'signature' '/' (lookup member 'kind')) symbol=member}};</code></pre>
<a href="{{ref}}"><em>» more...</em></a>
<a href="{{{relativize member.url}}}"><em>» more...</em></a>

{{/each}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- alias --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- concept --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- enum --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{#if symbol.name}}Enum {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else}}Unnamed enum{{/if}}</h2>
{{{symbol.doc.brief}}}
Expand Down Expand Up @@ -30,7 +30,7 @@
<tbody>
{{#each symbol.members}}
<tr>
<td><a href="#{{ref}}">{{>types/declarator-id . nolink=true}}</a></td>
<td><a href="#{{anchor}}">{{>types/declarator-id . nolink=true}}</a></td>
<td>{{{doc.brief}}}</td>
</tr>
{{/each}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- enumerator --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>Enumerator {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- field --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- friend --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>Friend {{#if symbol.symbol}}{{symbol.symbol.name}}{{else}}{{symbol.type.name}}{{/if}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- function --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>Function {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- guides --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>Deduction guide {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- namespace --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{#if symbol.name}}Namespace {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else if symbol.parent}}Unnamed namespace{{else}}Global namespace{{/if}}</h2>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- record --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{#if symbol.name}}Class {{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}{{else}}Unnamed class{{/if}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- typedef --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- symbols/using.html.hbs --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>Using {{#if (eq symbol.class "namespace")}}Directive: {{symbol.qualifier.name}}{{else}}Declaration: {{symbol.name}}{{/if}}</h2>
{{{symbol.doc.brief}}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{!-- variable --}}
<div {{#if sectionref}}id="{{sectionref}}"{{/if}}>
<div id="{{symbol.anchor}}">
<div>
<h2>{{>types/nested-name-specifier symbol=symbol.parent}}{{symbol.name}}</h2>
{{{symbol.doc.brief}}}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Gen/adoc/DocVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ operator()(doc::Reference const& I)
if(I.id == SymbolID::invalid)
return (*this)(static_cast<const doc::Text&>(I));
fmt::format_to(std::back_inserter(dest_), "xref:{}[{}]",
corpus_.getXref(corpus_->get(I.id)), escapeAdoc(I.string));
corpus_.getURL(corpus_->get(I.id)), escapeAdoc(I.string));
}

std::size_t
Expand Down
Loading
Loading