Skip to content

Commit fcb6ce3

Browse files
committed
[FOLD] add generator support
1 parent 155bf14 commit fcb6ce3

File tree

6 files changed

+38
-10
lines changed

6 files changed

+38
-10
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
{{#if symbol.usingDirectives}}
6969
{{>symbol/members-table members=symbol.usingDirectives title="Using Directives"}}
7070

71+
{{/if}}
72+
{{! Related symbols }}
73+
{{#if symbol.doc.related}}
74+
{{>symbol/members-table members=symbol.doc.related title="Related functions"}}
75+
7176
{{/if}}
7277
{{! Description }}
7378
{{#if symbol.doc.description}}
@@ -174,13 +179,3 @@
174179
{{/each}}
175180

176181
{{/if}}
177-
{{! Related }}
178-
{{#if symbol.doc.related}}
179-
{{#> markup/dynamic-level-h }}Related{{/markup/dynamic-level-h}}
180-
181-
{{#each symbol.doc.related}}
182-
{{{.}}}
183-
184-
{{/each}}
185-
186-
{{/if}}

src/lib/Gen/adoc/DocVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,9 @@ void
287287
DocVisitor::
288288
operator()(doc::Reference const& I) const
289289
{
290+
if (I.Kind == doc::NodeKind::related)
291+
return;
292+
290293
if (I.id == SymbolID::invalid)
291294
{
292295
return (*this)(static_cast<doc::Text const&>(I));

src/lib/Gen/html/DocVisitor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ void
285285
DocVisitor::
286286
operator()(doc::Reference const& I) const
287287
{
288+
if (I.Kind == doc::NodeKind::related)
289+
return;
290+
288291
if (I.id == SymbolID::invalid)
289292
{
290293
return (*this)(static_cast<doc::Text const&>(I));

src/lib/Gen/xml/XMLWriter.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -785,6 +785,9 @@ writeNode(doc::Node const& node)
785785
case doc::NodeKind::copied:
786786
writeCopied(dynamic_cast<doc::Copied const&>(node));
787787
break;
788+
case doc::NodeKind::related:
789+
writeRelated(dynamic_cast<doc::Related const&>(node));
790+
break;
788791
case doc::NodeKind::throws:
789792
writeThrows(dynamic_cast<doc::Throws const&>(node));
790793
break;
@@ -841,6 +844,16 @@ writeCopied(
841844
});
842845
}
843846

847+
void
848+
XMLWriter::
849+
writeRelated(
850+
doc::Related const& node)
851+
{
852+
tags_.write("relates", node.string, {
853+
{ node.id }
854+
});
855+
}
856+
844857
void
845858
XMLWriter::
846859
writeLink(

src/lib/Gen/xml/XMLWriter.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class XMLWriter
8989
void writeTParam(doc::TParam const& node);
9090
void writeReference(doc::Reference const& node);
9191
void writeCopied(doc::Copied const& node);
92+
void writeRelated(doc::Related const& node);
9293
void writeThrows(doc::Throws const& node);
9394
void writeDetails(doc::Details const& node, llvm::StringRef tag = "");
9495
void writeSee(doc::See const& node, llvm::StringRef tag = "");
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/** A brief for A.
2+
*/
3+
struct A { };
4+
5+
/** A brief for B
6+
*/
7+
struct B { };
8+
9+
/** A brief for f.
10+
11+
@relates A
12+
*/
13+
void f();

0 commit comments

Comments
 (0)