Skip to content

Commit 99d0dd2

Browse files
committed
fix: specialization title links wrap correct components
1 parent 76bc993 commit 99d0dd2

File tree

235 files changed

+3175
-2702
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+3175
-2702
lines changed

include/mrdocs/Metadata/Info.hpp

-4
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,6 @@ tag_invoke(
341341
if (I.Parent)
342342
{
343343
io.map("parent", I.Parent);
344-
io.defer("parents", [&]
345-
{
346-
return getParents(*domCorpus, I);
347-
});
348344
}
349345
if (I.javadoc)
350346
{

share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{{#unless @root.config.multipage }}
1515
{{! Single page documentation: symbol is not available to the wrapper but it's available here }}
1616
{{! Include the symbol title at a higher level }}
17-
{{#> markup/h level=1 id=symbol.anchor }}{{> symbol/qualified-name symbol }}{{/markup/h}}
17+
{{#> markup/h level=1 id=symbol.anchor }}{{> symbol/qualified-name-title symbol }}{{/markup/h}}
1818
{{/unless}}
1919
{{! Brief }}
2020
{{#if symbol.doc.brief}}
@@ -83,7 +83,7 @@
8383
| Description
8484
{{#each symbol.friends }}
8585
{{#if symbol}}
86-
| {{#>markup/code}}{{> symbol/qualified-name symbol link=symbol }}{{/markup/code}}
86+
| {{#>markup/code}}{{> symbol/qualified-name symbol }}{{/markup/code}}
8787
| {{> javadoc/inline-brief symbol.doc.brief }}
8888
{{else}}
8989
| {{#>markup/code}}{{> type/declarator type }}{{/markup/code}}

share/mrdocs/addons/generator/common/partials/symbol/detail/members-table-row.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
{{~> symbol/name-info . nolink=true~}}
99
{{~/if~}}
1010
{{~else~}}
11-
{{~#>markup/a href=url}}{{#>markup/code}}{{>symbol/name . nolink=true}}{{/markup/code}}{{/markup/a}} {{>symbol/special-function-suffix .~}}
11+
{{~#>markup/a href=url}}{{#>markup/code}}{{>symbol/name-text .}}{{/markup/code}}{{/markup/a}} {{>symbol/special-function-suffix .~}}
1212
{{~/if~}}
1313
{{~/markup/td}}
1414
{{#if includeBrief~}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{{!--
2+
Renders the symbol name in an appropriate format for section titles.
3+
4+
This is typically a linked name, but it can also be a special name like
5+
"see-below" or "implementation-defined".
6+
7+
Expected Context: {Symbol Object}
8+
9+
Optional parameters:
10+
nolink: If true, types and symbols will not be linked.
11+
link: Symbol that should be linked to, regardless of the original symbol.
12+
13+
Example:
14+
{{> declarator symbol }}
15+
16+
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
17+
--}}
18+
{{~#if (and (eq kind "function") (eq functionClass "conversion"))~}}
19+
{{! Conversion operator: "operator" and the type declarator ~}}
20+
operator {{>type/declarator return nolink=true~}}
21+
{{~else if (eq kind "guide")~}}
22+
{{! Deduction guide: "deduced" type declarator ~}}
23+
{{>type/declarator deduced nolink=true~}}
24+
{{~else~}}
25+
{{! Symbol with URL: link to the symbol documentation ~}}
26+
{{~#if name~}}
27+
{{~name~}}
28+
{{~else if parent ~}}
29+
Unnamed {{or tag kind~}}
30+
{{~else ~}}
31+
Global namespace
32+
{{~/if~}}
33+
{{~#if (contains (arr "explicit" "partial") template.kind)~}}
34+
{{! Explicit or partial template: render the template arguments ~}}
35+
{{>template/args args=template.args nolink=true~}}
36+
{{~/if~}}
37+
{{~/if~}}

share/mrdocs/addons/generator/common/partials/symbol/name.hbs

+9-18
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,20 @@
88
99
Optional parameters:
1010
nolink: If true, types and symbols will not be linked.
11-
link: Symbol that should be linked to, regardless of the original symbol.
1211
1312
Example:
1413
{{> declarator symbol }}
1514
1615
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
1716
--}}
18-
{{#if (and (eq kind "function") (eq functionClass "conversion"))~}}
17+
{{~#if (and (eq kind "function") (eq functionClass "conversion"))~}}
1918
{{! Conversion operator: "operator" and the type declarator ~}}
20-
operator {{>type/declarator return nolink=nolink~}}
21-
{{else if (eq kind "guide")~}}
19+
operator {{>type/declarator return nolink=false~}}
20+
{{~else if (eq kind "guide")~}}
2221
{{! Deduction guide: "deduced" type declarator ~}}
23-
{{>type/declarator deduced nolink=nolink~}}
24-
{{else~}}
25-
{{#if (and link.url (not nolink))~}}
26-
{{! Symbol with URL: link to the symbol documentation ~}}
27-
{{#>markup/a href=link.url}}{{or name "<unnamed>"}}{{/markup/a~}}
28-
{{else~}}
29-
{{! Symbol without URL: plain text ~}}
30-
{{or name "<unnamed>"~}}
31-
{{/if~}}
32-
{{#if (contains (arr "explicit" "partial") template.kind)~}}
33-
{{! Explicit or partial template: render the template arguments ~}}
34-
{{>template/args args=template.args nolink=nolink~}}
35-
{{/if~}}
36-
{{/if}}
22+
{{>type/declarator deduced nolink=false~}}
23+
{{~else if (and url (not nolink))~}}
24+
{{#>markup/a href=url}}{{>symbol/name-text}}{{/markup/a~}}
25+
{{~else~}}
26+
{{~>symbol/name-text~}}
27+
{{~/if~}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{!--
2+
Renders the qualified symbol name as text only
3+
4+
This partial renders the qualified symbol name as text only.
5+
6+
Expected Context: {Symbol Object}
7+
8+
Example:
9+
{{> symbol/qualified-name symbol }}
10+
11+
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
12+
--}}
13+
{{~#if (and parent parent.parent)~}}
14+
{{~> symbol/qualified-name-text parent ~}}::
15+
{{~/if~}}
16+
{{~#if name ~}}
17+
{{~> symbol/name-text . ~}}
18+
{{~/if~}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{!--
2+
Renders the qualified symbol in the format used in titles
3+
4+
Titles use a format where all parent namespaces are linked to their documentation.
5+
A parent is included only if it has a name. Unnamed namespaces are not included.
6+
7+
In general, the last symbol name is then appended to the linked namespaces without
8+
any link because it represents the current symbol. However, there are some
9+
exceptions to that:
10+
11+
- If the symbol is a conversion operator, the conversion type is linked.
12+
- If the symbol is a template specialization, the primary template is linked
13+
and the links to the arguments are appended to the name.
14+
- In other cases, the symbol name text is used without any links.
15+
16+
Expected Context: {Symbol Object}
17+
18+
Example:
19+
{{> symbol/title-qualified-name symbol }}
20+
21+
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
22+
--}}
23+
{{~#if (and parent parent.parent)~}}
24+
{{~> symbol/qualified-name-title parent is-qualified-name-parent=true ~}}{{#if parent.name }}::{{/if}}
25+
{{~/if~}}
26+
{{~#if (and (eq kind "function") (eq functionClass "conversion"))~}}
27+
{{~> symbol/name . ~}}
28+
{{~else if is-qualified-name-parent ~}}
29+
{{!~ If this is a parent, we only print it if it really has a name ~}}
30+
{{~#if name ~}}
31+
{{~> symbol/name . ~}}
32+
{{~/if~}}
33+
{{~else if (eq kind "guide")~}}
34+
{{>type/declarator deduced nolink=false~}}
35+
{{~else if (contains (arr "explicit" "partial") template.kind)~}}
36+
{{!~ If the last part is a template specialization, we include links to primary template and the arguments. ~}}
37+
{{!~ If the primary template wasn't correctly extracted for some reason, we just print the name as usual. ~}}
38+
{{#if template.primary }}{{~>symbol/name template.primary ~}}{{else}}{{ name }}{{/if}}{{>template/args args=template.args nolink=false~}}
39+
{{~else~}}
40+
{{~> symbol/name-text . ~}}
41+
{{~/if~}}
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
{{!--
2-
Renders the qualified symbol name in an appropriate format for section titles.
2+
Renders the qualified symbol with a link to the symbol's documentation.
33
4-
This partial renders the symbol name in a format where all parent namespaces
5-
are linked to their documentation. The symbol name is then appended to the
6-
linked namespaces.
7-
8-
It also includes exceptions for unnamed symbols and friend declarations.
9-
Unnamed symbols need to be handled differently as they have no name to display.
10-
Friend declarations need to be handled differently as they are not part of the
11-
symbol hierarchy and need to be linked to the befriended symbol or type.
4+
This partial renders the symbol name in a format where the whole qualified name
5+
is linked to the documentation of the main symbol.
126
137
Expected Context: {Symbol Object}
148
@@ -17,21 +11,8 @@
1711
1812
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
1913
--}}
20-
{{! We remove whitespace between all tag so the result is in a single line ~}}
21-
{{~#if name~}}
22-
{{! General case: linked parent symbols followed by the symbol name ~}}
23-
{{#each parents~}}
24-
{{#if name~}}
25-
{{>symbol/name . link=. nolink=../nolink}}::
26-
{{~/if}}
27-
{{~/each}}{{>symbol/name .}}
14+
{{~#if (and url (not nolink))~}}
15+
{{#>markup/a href=url}}{{>symbol/qualified-name-text}}{{/markup/a~}}
2816
{{~else~}}
29-
{{! Unnamed symbol: use the symbol type in the title ~}}
30-
{{~#if parent~}}
31-
{{! Symbol with no name but with a parent ~}}
32-
Unnamed
33-
{{~else~}}
34-
{{! Symbol with no name and no parent: Global symbol ~}}
35-
Global
36-
{{~/if}} {{or tag kind~}}
17+
{{~>symbol/qualified-name-text~}}
3718
{{~/if~}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{!--
2+
Renders the qualified symbol name with a link to each component
3+
4+
This partial renders the symbol name in a format where each component
5+
is linked to their documentation.
6+
7+
Expected Context: {Symbol Object}
8+
9+
Example:
10+
{{> symbol/qualified-name symbol }}
11+
12+
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
13+
--}}
14+
{{! We remove whitespace between all tag so the result is in a single line ~}}
15+
{{~#if (and parent parent.parent)~}}
16+
{{~> symbol/qualified-names parent ~}}::
17+
{{~/if~}}
18+
{{~> symbol/name . ~}}

share/mrdocs/addons/generator/common/partials/symbol/signature.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
1212
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
1313
--}}
14-
{{> (concat 'symbol/signature/' kind) }}
14+
{{> (concat 'symbol/signature/' kind) nolink=nolink }}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{>template/head template}}
22

3-
concept {{>symbol/name symbol}} = {{constraint}};
3+
concept {{>symbol/name-text symbol}} = {{constraint}};
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
enum {{#if isScoped}}class {{/if}}{{>symbol/name .~}}
1+
enum {{#if isScoped}}class {{/if}}{{>symbol/name-text .~}}
22
{{#if type}} : {{>type/declarator type}}{{/if}};

share/mrdocs/addons/generator/common/partials/symbol/signature/function.hbs

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
{{/if~}}
1515
{{#if (eq functionClass "normal")}}{{>type/declarator-prefix return}}
1616
{{/if~}}
17-
{{>symbol/name symbol link=(select link link template.primary)}}
17+
{{~#if force-link~}}
18+
{{>symbol/name symbol }}
19+
{{~else if (eq functionClass "conversion")~}}
20+
{{>symbol/name symbol }}
21+
{{~else if (contains (arr "explicit" "partial") template.kind)~}}
22+
{{>symbol/name template.primary ~}}{{>template/args args=template.args nolink=true~}}
23+
{{~else~}}
24+
{{>symbol/name-text symbol }}
25+
{{~/if~}}
1826
({{#if isExplicitObjectMemberFunction}}this {{/if}}{{#each params}}{{#unless (and @first @last)}}
1927
{{/unless}}{{>type/declarator type decl-name=name~}}
2028
{{#if default}} = {{default}}{{/if~}}

share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{{#if template}}{{>template/head template}}
22
{{/if~}}
3-
{{#if isFriend}}friend {{/if}}{{tag}} {{>symbol/name symbol link=(select link link template.primary)~}}
3+
{{#if isFriend}}friend {{/if~}}
4+
{{~tag}} {{#if (contains (arr "explicit" "partial") template.kind)~}}
5+
{{>symbol/name template.primary ~}}{{>template/args args=template.args nolink=nolink~}}
6+
{{~else~}}
7+
{{>symbol/name-text symbol ~}}
8+
{{~/if}}
49
{{#unless bases~}}
510
{{else if isFriend~}}
611
{{else}}

share/mrdocs/addons/generator/common/partials/symbol/signature/variable.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{{/if~}}
1111
{{#if isThreadLocal}}thread_local
1212
{{/if~}}
13-
{{>type/declarator-prefix type}} {{>symbol/name symbol link=(select link link template.primary)~}}
13+
{{>type/declarator-prefix type}} {{>symbol/name-text symbol ~}}
1414
{{#if isBitfield}} : {{bitfieldWidth}}{{/if~}}
1515
{{#if default}} = {{default}}{{/if~}}
1616
{{>type/declarator-suffix type~}}

share/mrdocs/addons/generator/common/partials/symbol/signatures.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
{{#each members as | member |}}
2121
{{#if member.doc.brief}}{{> javadoc/brief member.doc.brief }}{{/if}}
2222
{{#> markup/code-block }}
23-
{{> symbol/signature member link=member}}
23+
{{> symbol/signature/function member force-link=true }}
2424
{{/markup/code-block}}
2525
{{#> markup/span class="small" }}{{#> markup/a href=member.url }}{{#>markup/em }}» more{{ str "..." }}{{/markup/em}}{{/markup/a}}{{/markup/span}}
2626

share/mrdocs/addons/generator/html/partials/symbol.html.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
{{#each symbol.friends }}
114114
<tr>
115115
{{#if symbol}}
116-
<td>{{#>markup/code}}{{> symbol/name symbol link=symbol }}{{/markup/code}}</td>
116+
<td>{{#>markup/code}}{{> symbol/name symbol }}{{/markup/code}}</td>
117117
<td>{{> javadoc/inline-brief symbol.doc.brief }}</td>
118118
{{else}}
119119
<td>{{#>markup/code}}{{> type/declarator type }}{{/markup/code}}</td>

src/lib/Metadata/Template.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ tag_invoke(
341341
io.defer("kind", [&] {
342342
return toString(I.specializationKind());
343343
});
344-
io.map("primary", I.Primary);
344+
if (I.Primary != SymbolID::invalid)
345+
{
346+
io.map("primary", I.Primary);
347+
}
345348
io.map("params", dom::LazyArray(I.Params, domCorpus));
346349
io.map("args", dom::LazyArray(I.Args, domCorpus));
347350
io.map("requires", dom::stringOrNull(I.Requires.Written));

0 commit comments

Comments
 (0)