diff --git a/src/lib/AST/ParseJavadoc.cpp b/src/lib/AST/ParseJavadoc.cpp index 8b417bdec9..6a79506c99 100644 --- a/src/lib/AST/ParseJavadoc.cpp +++ b/src/lib/AST/ParseJavadoc.cpp @@ -1026,22 +1026,30 @@ visitBlockCommandComment( visitChildren(C->getParagraph()); if(! paragraph.children.empty()) { - // the first TextComment is the heading text - doc::String text(std::move( - paragraph.children.front()->string)); - - // VFALCO Unfortunately clang puts at least - // one space in front of the text, which seems - // incorrect. - auto const s = trim(text); - if(s.size() != text.size()) - text = s; - - doc::Heading heading(std::move(text)); - jd_.emplace_back(std::move(heading)); - - // remaining TextComment, if any - paragraph.children.erase(paragraph.children.begin()); + if (C->getNumArgs() > 0) + { + jd_.emplace_back(doc::Heading(C->getArgText(0).str())); + } + else + { + // the first TextComment is the heading text + doc::String text(std::move( + paragraph.children.front()->string)); + + // VFALCO Unfortunately clang puts at least + // one space in front of the text, which seems + // incorrect. + auto const s = trim(text); + if(s.size() != text.size()) + text = s; + + doc::Heading heading(std::move(text)); + jd_.emplace_back(std::move(heading)); + + // remaining TextComment, if any + paragraph.children.erase(paragraph.children.begin()); + } + if(! paragraph.children.empty()) jd_.emplace_back(std::move(paragraph)); } diff --git a/test-files/golden-tests/para-3.adoc b/test-files/golden-tests/para-3.adoc new file mode 100644 index 0000000000..9e8c11410c --- /dev/null +++ b/test-files/golden-tests/para-3.adoc @@ -0,0 +1,51 @@ += Reference +:mrdocs: + +[#index] +== Global namespace + +=== Functions +[cols=2] +|=== +| Name | Description + +| <<#my_function,`my_function`>> +| A function + +|=== + +[#my_function] +== my_function + +A function + +=== Synopsis + +Declared in `<para‐3.cpp>` + +[source,cpp,subs="verbatim,replacements,macros,-callouts"] +---- +void +my_function(); +---- + +=== Description + + +=== A heading. +Some text. + +More text... + +Another paragraph +Next line + + +=== Exception safety +No‐throw guarantee. + + + + + +[.small]#Created with https://www.mrdocs.com[MrDocs]# diff --git a/test-files/golden-tests/para-3.cpp b/test-files/golden-tests/para-3.cpp new file mode 100644 index 0000000000..2d16ecdecc --- /dev/null +++ b/test-files/golden-tests/para-3.cpp @@ -0,0 +1,16 @@ +/** + * \brief A function + * + * \par + * A heading. + * Some text. + * + * More text... + * + * Another paragraph + * Next line + * + * \par Exception safety + * No-throw guarantee. + */ +void my_function(); diff --git a/test-files/golden-tests/para-3.html b/test-files/golden-tests/para-3.html new file mode 100644 index 0000000000..5e2c35ffb1 --- /dev/null +++ b/test-files/golden-tests/para-3.html @@ -0,0 +1,67 @@ + +
+<para-3.cpp>
+
+void
+my_function();
+
+
+Some text.
+ +More text...
+ +Another paragraph Next line
+ +No-throw guarantee.
+ + + +