Skip to content

Commit f8e72bb

Browse files
committed
fix: doc::Overview
1 parent 04fc1dd commit f8e72bb

File tree

4 files changed

+98
-6
lines changed

4 files changed

+98
-6
lines changed

lib/-adoc/AdocCorpus.cpp

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <fmt/format.h>
1616
#include <iterator>
1717

18+
#include <llvm/Support/raw_ostream.h>
19+
1820
namespace clang {
1921
namespace mrdox {
2022
namespace adoc {
@@ -58,7 +60,29 @@ DocVisitor::
5860
operator()(
5961
doc::Admonition const& I)
6062
{
61-
//dest_ += I.string;
63+
std::string_view label;
64+
switch(I.admonish)
65+
{
66+
case doc::Admonish::note:
67+
label = "NOTE";
68+
break;
69+
case doc::Admonish::tip:
70+
label = "TIP";
71+
break;
72+
case doc::Admonish::important:
73+
label = "IMPORTANT";
74+
break;
75+
case doc::Admonish::caution:
76+
label = "CAUTION";
77+
break;
78+
case doc::Admonish::warning:
79+
label = "WARNING";
80+
break;
81+
default:
82+
MRDOX_UNREACHABLE();
83+
}
84+
dest_ += fmt::format("[{}]\n", label);
85+
(*this)(static_cast<doc::Paragraph const&>(I));
6286
}
6387

6488
void
@@ -123,6 +147,7 @@ operator()(
123147
}
124148
}
125149
dest_.push_back('\n');
150+
dest_.push_back('\n');
126151
}
127152

128153
void
@@ -276,7 +301,9 @@ class DomJavadoc : public dom::LazyObjectImpl
276301
for(auto const& t : nodes)
277302
doc::visit(*t, visitor);
278303
if(! s.empty())
304+
{
279305
list.emplace_back(key, std::move(s));
306+
}
280307
};
281308

282309
dom::Object

lib/Metadata/Javadoc.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ makeOverview(
130130
TParam const*>(it->get()));
131131
break;
132132
case Kind::paragraph:
133-
ov.brief = static_cast<
134-
Paragraph const*>(it->get());
133+
if(! ov.brief)
134+
ov.brief = static_cast<
135+
Paragraph const*>(it->get());
136+
else
137+
ov.blocks.push_back(it->get());
135138
break;
136139
default:
137140
ov.blocks.push_back(it->get());

test-files/adoc/test.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,27 @@
1-
struct T {};
1+
/** The type of string_view used by the library
2+
3+
String views are used to pass character
4+
buffers into or out of functions. Ownership
5+
of the underlying character buffer is not
6+
transferred; the caller is responsible for
7+
ensuring that the lifetime of character
8+
buffer extends until it is no longer
9+
referenced.
10+
11+
@note This alias is no longer supported and
12+
should not be used in new code. Please use
13+
`core::string_view` instead.
14+
15+
This alias is included for backwards
16+
compatibility with earlier versions of the
17+
library.
18+
19+
However, it will be removed in future releases,
20+
and using it in new code is not recommended.
21+
22+
Please use the updated version instead to
23+
ensure compatibility with future versions of
24+
the library.
25+
26+
*/
27+
struct string_view{};

test-files/adoc/test.xml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,44 @@
22
<mrdox xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://github.com/cppalliance/mrdox/raw/develop/mrdox.rnc">
44
<namespace>
5-
<struct name="T" id="CgGNdHpW5mG/i5741WPYQDw28OQ=">
6-
<file path="test.cpp" line="1" class="def"/>
5+
<struct name="string_view" id="AbyPschn1Km27CQSV03D1w7MAo0=">
6+
<file path="test.cpp" line="27" class="def"/>
7+
<doc>
8+
<para>
9+
<text> The type of string_view used by the library</text>
10+
</para>
11+
<para>
12+
<text> String views are used to pass character</text>
13+
<text> buffers into or out of functions. Ownership</text>
14+
<text> of the underlying character buffer is not</text>
15+
<text> transferred; the caller is responsible for</text>
16+
<text> ensuring that the lifetime of character</text>
17+
<text> buffer extends until it is no longer</text>
18+
<text> referenced.</text>
19+
</para>
20+
<para>
21+
<text></text>
22+
</para>
23+
<para class="note">
24+
<text> This alias is no longer supported and</text>
25+
<text> should not be used in new code. Please use</text>
26+
<text> `core::string_view` instead.</text>
27+
</para>
28+
<para>
29+
<text> This alias is included for backwards</text>
30+
<text> compatibility with earlier versions of the</text>
31+
<text> library.</text>
32+
</para>
33+
<para>
34+
<text> However, it will be removed in future releases,</text>
35+
<text> and using it in new code is not recommended.</text>
36+
</para>
37+
<para>
38+
<text> Please use the updated version instead to</text>
39+
<text> ensure compatibility with future versions of</text>
40+
<text> the library.</text>
41+
</para>
42+
</doc>
743
</struct>
844
</namespace>
945
</mrdox>

0 commit comments

Comments
 (0)