Skip to content

Commit 8bcfb6e

Browse files
committed
feat: support @relates
1 parent 390159e commit 8bcfb6e

File tree

16 files changed

+212
-3
lines changed

16 files changed

+212
-3
lines changed

include/mrdocs/Metadata/Javadoc.hpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ enum class Kind
126126
throws,
127127
details,
128128
see,
129+
related,
129130
precondition,
130131
postcondition
131132
};
@@ -358,6 +359,25 @@ struct Copied : Reference
358359
}
359360
};
360361

362+
/** A reference to a related symbol.
363+
*/
364+
struct Related : Reference
365+
{
366+
static constexpr Kind static_kind = Kind::related;
367+
368+
Related(String string_ = String()) noexcept
369+
: Reference(std::move(string_), Kind::related)
370+
{
371+
}
372+
373+
bool operator==(Related const&) const noexcept = default;
374+
bool equals(Node const& other) const noexcept override
375+
{
376+
return kind == other.kind &&
377+
*this == static_cast<const Related&>(other);
378+
}
379+
};
380+
361381
//------------------------------------------------
362382
//
363383
// Block nodes
@@ -802,6 +822,8 @@ visit(
802822
return f.template operator()<Precondition>(std::forward<Args>(args)...);
803823
case Kind::postcondition:
804824
return f.template operator()<Postcondition>(std::forward<Args>(args)...);
825+
case Kind::related:
826+
return f.template operator()<Related>(std::forward<Args>(args)...);
805827
default:
806828
return f.template operator()<void>(std::forward<Args>(args)...);
807829
}
@@ -867,6 +889,8 @@ visit(
867889
return visitor.template visit<Precondition>();
868890
case Kind::postcondition:
869891
return visitor.template visit<Postcondition>();
892+
case Kind::related:
893+
return visitor.template visit<Related>();
870894
default:
871895
MRDOCS_UNREACHABLE();
872896
}
@@ -901,6 +925,7 @@ struct Overview
901925
std::vector<See const*> sees;
902926
std::vector<Precondition const*> preconditions;
903927
std::vector<Postcondition const*> postconditions;
928+
std::vector<Related const*> related;
904929
};
905930

906931
MRDOCS_DECL dom::String toString(Style style) noexcept;

share/mrdocs/addons/generator/asciidoc/partials/symbols/alias.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@
2828
{{/each}}
2929
3030
{{/if}}
31+
32+
{{#if symbol.doc.related}}
33+
=={{#unless is_multipage}}={{/unless}} Related
34+
35+
{{#each symbol.doc.related}}
36+
{{.}}
37+
38+
{{/each}}
39+
40+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/concept.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@
2828
{{/each}}
2929
3030
{{/if}}
31+
32+
{{#if symbol.doc.related}}
33+
=={{#unless is_multipage}}={{/unless}} Related
34+
35+
{{#each symbol.doc.related}}
36+
{{.}}
37+
38+
{{/each}}
39+
40+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/enum.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@
3838
{{/each}}
3939
4040
{{/if}}
41+
42+
{{#if symbol.doc.related}}
43+
=={{#unless is_multipage}}={{/unless}} Related
44+
45+
{{#each symbol.doc.related}}
46+
{{.}}
47+
48+
{{/each}}
49+
50+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/enumerator.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,13 @@
2929
{{/each}}
3030
3131
{{/if}}
32+
33+
{{#if symbol.doc.related}}
34+
=={{#unless is_multipage}}={{/unless}} Related
35+
36+
{{#each symbol.doc.related}}
37+
{{.}}
38+
39+
{{/each}}
40+
41+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/field.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@
2828
{{/each}}
2929
3030
{{/if}}
31+
32+
{{#if symbol.doc.related}}
33+
=={{#unless is_multipage}}={{/unless}} Related
34+
35+
{{#each symbol.doc.related}}
36+
{{.}}
37+
38+
{{/each}}
39+
40+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/friend.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@
2828
{{/each}}
2929
3030
{{/if}}
31+
32+
{{#if symbol.doc.related}}
33+
=={{#unless is_multipage}}={{/unless}} Related
34+
35+
{{#each symbol.doc.related}}
36+
{{.}}
37+
38+
{{/each}}
39+
40+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/function.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,13 @@
9595
{{/each}}
9696
9797
{{/if}}
98+
99+
{{#if symbol.doc.related}}
100+
=={{#unless is_multipage}}={{/unless}} Related
101+
102+
{{#each symbol.doc.related}}
103+
{{.}}
104+
105+
{{/each}}
106+
107+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/guide.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,13 @@
2828
{{/each}}
2929
3030
{{/if}}
31+
32+
{{#if symbol.doc.related}}
33+
=={{#unless is_multipage}}={{/unless}} Related
34+
35+
{{#each symbol.doc.related}}
36+
{{.}}
37+
38+
{{/each}}
39+
40+
{{/if}}

share/mrdocs/addons/generator/asciidoc/partials/symbols/record.adoc.hbs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,13 @@
4848
{{/each}}
4949
5050
{{/if}}
51+
52+
{{#if symbol.doc.related}}
53+
=={{#unless is_multipage}}={{/unless}} Related
54+
55+
{{#each symbol.doc.related}}
56+
{{.}}
57+
58+
{{/each}}
59+
60+
{{/if}}

0 commit comments

Comments
 (0)