Skip to content

Commit e5d9bd1

Browse files
author
Gennaro Prota
committed
feat: AsciiDoc and HTML outputs don't show the final specifier in a comment
This makes `final` appear in normal code (rather than a comment), but omits the semicolon to avoid showing an incorrect code fragment.
1 parent d0bd916 commit e5d9bd1

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

share/mrdocs/addons/generator/common/partials/symbol/signature/record.hbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
{{#unless (eq access ../defaultAccess)}} {{access}}{{/unless~}}
1818
{{#if isVirtual}} virtual{{/if}} {{>type/declarator type~}}
1919
{{/each~}}
20-
{{/unless}}{{#isSeeBelow}} { /* see-below */ }{{/isSeeBelow}};{{#if isFinal}} /* final */{{/if}}
20+
{{!-- Don't show a semicolon if the record is final, because something
21+
like `class A final;` is ill-formed (`final` can't be used on a
22+
non-defining declaration). --}}
23+
{{/unless}}{{#isSeeBelow}} { /* see-below */ }{{/isSeeBelow}}{{#if isFinal}} final{{else}};{{/if}}

test-files/golden-tests/symbols/record/final_class.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Declared in `<final_class.cpp>`
2222

2323
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
2424
----
25-
class A; /* final */
25+
class A final
2626
----
2727

2828
[#B]
@@ -35,7 +35,7 @@ Declared in `<final_class.cpp>`
3535
[source,cpp,subs="verbatim,replacements,macros,-callouts"]
3636
----
3737
template<typename T>
38-
class B; /* final */
38+
class B final
3939
----
4040

4141

test-files/golden-tests/symbols/record/final_class.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h3>Synopsis</h3>
3434
Declared in <code>&lt;final_class.cpp&gt;</code></div>
3535
<pre>
3636
<code class="source-code cpp">
37-
class A; /* final */
37+
class A final
3838
</code>
3939
</pre>
4040
</div>
@@ -52,7 +52,7 @@ <h3>Synopsis</h3>
5252
<pre>
5353
<code class="source-code cpp">
5454
template&lt;typename T&gt;
55-
class B; /* final */
55+
class B final
5656
</code>
5757
</pre>
5858
</div>

0 commit comments

Comments
 (0)