Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/lib/Metadata/Finalizers/DocCommentFinalizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,15 @@ setAutoBrief(DocComment& doc) const

for (auto it = doc.Document.begin(); it != doc.Document.end();)
{
// A heading marks the start of a section (as of writing
// this, the only way to produce one is an @par with an
// explicit title). Anything that follows is the body of
// that section, not the symbol's introductory prose, so
// stop looking for a brief here. See issue #1162.
if ((*it)->Kind == doc::BlockKind::Heading)
{
return;
}
if (auto& block = *it;
block->Kind == doc::BlockKind::Paragraph)
{
Expand Down
40 changes: 40 additions & 0 deletions test-files/golden-tests/javadoc/paragraph/par-1.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
| Brief
| link:#f4[`f4`]
| Brief
| link:#f5[`f5`]
|
| link:#f6[`f6`]
| A function.
|===

[#f1]
Expand Down Expand Up @@ -107,5 +111,41 @@ f4();
----
void f4();
----
[#f5]
== f5

=== Synopsis

Declared in `<par‐1.cpp>`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
f5();
----

=== Custom par

Paragraph 5

[#f6]
== f6

A function.

=== Synopsis

Declared in `<par‐1.cpp>`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
f6();
----

=== Custom par

Paragraph 6


[.small]#Created with https://www.mrdocs.com[MrDocs]#
20 changes: 19 additions & 1 deletion test-files/golden-tests/javadoc/paragraph/par-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,22 @@ void f3();
void f4();
@endcode
*/
void f4();
void f4();

// No front matter: the body of @par must not be promoted
// to an auto-brief (issue #1162).
/**

@par Custom par
Paragraph 5
*/
void f5();

// Same shape as f5 but with explicit front matter: the front
// matter becomes the brief, the @par section is preserved.
/** A function.

@par Custom par
Paragraph 6
*/
void f6();
45 changes: 44 additions & 1 deletion test-files/golden-tests/javadoc/paragraph/par-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ <h2>
<td><a href="#f1"><code>f1</code></a> </td><td>Brief</td></tr><tr>
<td><a href="#f2"><code>f2</code></a> </td><td>Brief</td></tr><tr>
<td><a href="#f3"><code>f3</code></a> </td><td>Brief</td></tr><tr>
<td><a href="#f4"><code>f4</code></a> </td><td>Brief</td></tr>
<td><a href="#f4"><code>f4</code></a> </td><td>Brief</td></tr><tr>
<td><a href="#f5"><code>f5</code></a> </td><td></td></tr><tr>
<td><a href="#f6"><code>f6</code></a> </td><td>A function.</td></tr>
</tbody>
</table>

Expand Down Expand Up @@ -123,6 +125,47 @@ <h2>
void f4();
</code></pre></div>
</div>
<div>
<div>
<h2 id="f5">
f5</h2>
</div>
<div>
<h3>
Synopsis</h3>
<div>
Declared in <code>&lt;par-1.cpp&gt;</code></div>
<pre><code class="source-code cpp">void
f5();</code></pre>
</div>
<div>
<h2>
Custom par</h2>
<p>Paragraph 5</p>
</div>
</div>
<div>
<div>
<h2 id="f6">
f6</h2>
<div>
<p>A function.</p>
</div>
</div>
<div>
<h3>
Synopsis</h3>
<div>
Declared in <code>&lt;par-1.cpp&gt;</code></div>
<pre><code class="source-code cpp">void
f6();</code></pre>
</div>
<div>
<h2>
Custom par</h2>
<p>Paragraph 6</p>
</div>
</div>

</div>
<footer class="mrdocs-footer">
Expand Down
89 changes: 89 additions & 0 deletions test-files/golden-tests/javadoc/paragraph/par-1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<functions>0MJUv5yGFR9nXWFLeYc+rjOY+iM=</functions>
<functions>khwJweIqd5FuWAg8T+l+GEljQVc=</functions>
<functions>5wJFEWD4Ev/Vf3QN/mFlKhtbC6E=</functions>
<functions>RnDTZyCZuSqydMEPutN0yG4E/xg=</functions>
<functions>NEkWCLiknLGzCD6JnXuBTSAAne8=</functions>
</namespace-tranche>
</namespace>
<function>
Expand Down Expand Up @@ -204,4 +206,91 @@
</named>
<func-class>normal</func-class>
</function>
<function>
<name>f5</name>
<source>
<location>
<short-path>par-1.cpp</short-path>
<source-path>par-1.cpp</source-path>
<line-number>52</line-number>
<column-number>1</column-number>
<documented>1</documented>
</location>
</source>
<kind>function</kind>
<id>RnDTZyCZuSqydMEPutN0yG4E/xg=</id>
<extraction>regular</extraction>
<parent>//////////////////////////8=</parent>
<doc-comment>
<heading>
<kind>heading</kind>
<text>
<kind>text</kind>
<literal>Custom par</literal>
</text>
<level>1</level>
</heading>
<paragraph>
<kind>paragraph</kind>
<text>
<kind>text</kind>
<literal>Paragraph 5</literal>
</text>
</paragraph>
</doc-comment>
<named>
<name>
<kind>identifier</kind>
<identifier>void</identifier>
</name>
</named>
<func-class>normal</func-class>
</function>
<function>
<name>f6</name>
<source>
<location>
<short-path>par-1.cpp</short-path>
<source-path>par-1.cpp</source-path>
<line-number>61</line-number>
<column-number>1</column-number>
<documented>1</documented>
</location>
</source>
<kind>function</kind>
<id>NEkWCLiknLGzCD6JnXuBTSAAne8=</id>
<extraction>regular</extraction>
<parent>//////////////////////////8=</parent>
<doc-comment>
<heading>
<kind>heading</kind>
<text>
<kind>text</kind>
<literal>Custom par</literal>
</text>
<level>1</level>
</heading>
<paragraph>
<kind>paragraph</kind>
<text>
<kind>text</kind>
<literal>Paragraph 6</literal>
</text>
</paragraph>
<brief>
<kind>brief</kind>
<text>
<kind>text</kind>
<literal>A function.</literal>
</text>
</brief>
</doc-comment>
<named>
<name>
<kind>identifier</kind>
<identifier>void</identifier>
</name>
</named>
<func-class>normal</func-class>
</function>
</mrdocs>
Loading