Skip to content

Commit 833dee2

Browse files
committed
fix: uniform signature code blocks
1 parent 36a9eb8 commit 833dee2

23 files changed

+247
-184
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[source,cpp,subs="verbatim,macros,-callouts"]
2+
----
3+
{{> @partial-block }}
4+
5+
----
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_{{> @partial-block }}_

share/mrdocs/addons/generator/adoc/partials/symbol.adoc.hbs

+2-18
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,12 @@
2323

2424
{{/if}}
2525
{{! Synopsis }}
26-
{{#unless (contains (arr "namespace") symbol.kind)}}
26+
{{#unless (eq symbol.kind "namespace")}}
2727
{{#> markup/dynamic-level-h }}Synopsis{{/markup/dynamic-level-h}}
2828

2929
{{>location/source dcl=(primary_location symbol)}}
3030

31-
{{#if (ne symbol.kind "overloads")}}
32-
[source,cpp,subs="verbatim,macros,-callouts"]
33-
----
34-
{{> symbol/signature symbol }}
35-
36-
----
37-
38-
{{else}}
39-
{{#each symbol.members as | member |}}
40-
[source,cpp,subs="verbatim,macros,-callouts"]
41-
----
42-
{{> symbol/signature member link=member}}
43-
44-
----
45-
46-
{{/each}}
47-
{{/if}}
31+
{{> symbol/signatures symbol }}
4832
{{/unless}}
4933
{{! Tranches }}
5034
{{#if symbol.interface}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{{!--
2+
Renders code blocks with signatures related to a symbol
3+
4+
For most symbols, this will render a single code block with the symbol's signature.
5+
6+
For function overloads, this will render a code block for each overload.
7+
8+
Expected Context: {Symbol Object}
9+
10+
Example:
11+
{{> symbol/signatures symbol }}
12+
13+
See: https://mrdocs.com/docs/mrdocs/develop/generators.html#dom_reference
14+
--}}
15+
{{#if (ne kind "overloads")}}
16+
{{#> markup/code-block }}
17+
{{> symbol/signature }}
18+
{{/markup/code-block}}
19+
20+
{{else}}
21+
{{#each members as | member |}}
22+
{{#> markup/code-block }}
23+
{{> symbol/signature member link=member}}
24+
{{/markup/code-block}}
25+
26+
{{#> markup/span class="small" }}{{#> markup/a href=(relativize member.url) }}{{#>markup/em }}» more...{{/markup/em}}{{/markup/a}}{{/markup/span}}
27+
28+
{{/each}}
29+
{{/if}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<pre>
2+
<code class="source-code cpp">
3+
{{> @partial-block }}
4+
5+
</code>
6+
</pre>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<em>{{> @partial-block }}</em>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
<span{{#if class}} class="{{class}}"{{/if}}>
2-
{{> @partial-block }}
3-
4-
</span>
1+
<span{{#if class}} class="{{class}}"{{/if}}>{{> @partial-block }}</span>

share/mrdocs/addons/generator/html/partials/symbol.html.hbs

+2-18
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,14 @@
2929
</div>
3030
{{/unless}}
3131
{{! Synopsis }}
32-
{{#unless (contains (arr "namespace") symbol.kind)}}
32+
{{#unless (eq symbol.kind "namespace")}}
3333
<div>
3434
{{#> markup/dynamic-level-h level=2 }}Synopsis{{/markup/dynamic-level-h}}
3535
<div>
3636
{{>location/source dcl=(primary_location symbol)}}
3737
</div>
38-
{{#if (ne symbol.kind "overloads")}}
39-
<pre>
40-
<code class="source-code cpp">
41-
{{> symbol/signature symbol }}
42-
43-
</code>
44-
</pre>
45-
{{else}}
46-
{{#each symbol.members as | member |}}
47-
<pre>
48-
<code class="language-cpp">
49-
{{> symbol/signature member }}
38+
{{> symbol/signatures symbol }}
5039

51-
</code>
52-
</pre>
53-
<a href="{{{relativize member.url}}}"><em>» more...</em></a>
54-
{{/each}}
55-
{{/if}}
5640
</div>
5741
{{/unless}}
5842
{{! Tranches }}

test-files/golden-tests/explicit-ctor.adoc

+32
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,24 @@ explicit
5757
<<#Explicit-2constructor-02,Explicit>>();
5858
----
5959

60+
[.small]#<<#Explicit-2constructor-02,_» more..._>>#
61+
6062
[source,cpp,subs="verbatim,macros,-callouts"]
6163
----
6264
explicit
6365
<<#Explicit-2constructor-00,Explicit>>(<<#Explicit,Explicit>> const&);
6466
----
6567

68+
[.small]#<<#Explicit-2constructor-00,_» more..._>>#
69+
6670
[source,cpp,subs="verbatim,macros,-callouts"]
6771
----
6872
explicit
6973
<<#Explicit-2constructor-0b,Explicit>>(<<#Explicit,Explicit>>&&) noexcept;
7074
----
7175

76+
[.small]#<<#Explicit-2constructor-0b,_» more..._>>#
77+
7278
[source,cpp,subs="verbatim,macros,-callouts"]
7379
----
7480
explicit
@@ -77,6 +83,8 @@ explicit
7783
int);
7884
----
7985

86+
[.small]#<<#Explicit-2constructor-03,_» more..._>>#
87+
8088
[#Explicit-2constructor-02]
8189
== <<#Explicit,Explicit>>::Explicit
8290

@@ -161,18 +169,24 @@ pass:[explicit(true)]
161169
<<#ExplicitTrue-2constructor-0d,ExplicitTrue>>();
162170
----
163171

172+
[.small]#<<#ExplicitTrue-2constructor-0d,_» more..._>>#
173+
164174
[source,cpp,subs="verbatim,macros,-callouts"]
165175
----
166176
pass:[explicit(true)]
167177
<<#ExplicitTrue-2constructor-04,ExplicitTrue>>(<<#ExplicitTrue,ExplicitTrue>> const&);
168178
----
169179

180+
[.small]#<<#ExplicitTrue-2constructor-04,_» more..._>>#
181+
170182
[source,cpp,subs="verbatim,macros,-callouts"]
171183
----
172184
pass:[explicit(true)]
173185
<<#ExplicitTrue-2constructor-08,ExplicitTrue>>(<<#ExplicitTrue,ExplicitTrue>>&&) noexcept;
174186
----
175187

188+
[.small]#<<#ExplicitTrue-2constructor-08,_» more..._>>#
189+
176190
[source,cpp,subs="verbatim,macros,-callouts"]
177191
----
178192
pass:[explicit(true)]
@@ -181,6 +195,8 @@ pass:[explicit(true)]
181195
int);
182196
----
183197

198+
[.small]#<<#ExplicitTrue-2constructor-05,_» more..._>>#
199+
184200
[#ExplicitTrue-2constructor-0d]
185201
== <<#ExplicitTrue,ExplicitTrue>>::ExplicitTrue
186202

@@ -265,18 +281,24 @@ pass:[explicit(false)]
265281
<<#ExplicitFalse-2constructor-01,ExplicitFalse>>();
266282
----
267283

284+
[.small]#<<#ExplicitFalse-2constructor-01,_» more..._>>#
285+
268286
[source,cpp,subs="verbatim,macros,-callouts"]
269287
----
270288
pass:[explicit(false)]
271289
<<#ExplicitFalse-2constructor-08,ExplicitFalse>>(<<#ExplicitFalse,ExplicitFalse>> const&);
272290
----
273291

292+
[.small]#<<#ExplicitFalse-2constructor-08,_» more..._>>#
293+
274294
[source,cpp,subs="verbatim,macros,-callouts"]
275295
----
276296
pass:[explicit(false)]
277297
<<#ExplicitFalse-2constructor-0a,ExplicitFalse>>(<<#ExplicitFalse,ExplicitFalse>>&&) noexcept;
278298
----
279299

300+
[.small]#<<#ExplicitFalse-2constructor-0a,_» more..._>>#
301+
280302
[source,cpp,subs="verbatim,macros,-callouts"]
281303
----
282304
pass:[explicit(false)]
@@ -285,6 +307,8 @@ pass:[explicit(false)]
285307
int);
286308
----
287309

310+
[.small]#<<#ExplicitFalse-2constructor-04,_» more..._>>#
311+
288312
[#ExplicitFalse-2constructor-01]
289313
== <<#ExplicitFalse,ExplicitFalse>>::ExplicitFalse
290314

@@ -370,18 +394,24 @@ pass:[explicit(B)]
370394
<<#ExplicitExpression-2constructor-0b,ExplicitExpression>>();
371395
----
372396

397+
[.small]#<<#ExplicitExpression-2constructor-0b,_» more..._>>#
398+
373399
[source,cpp,subs="verbatim,macros,-callouts"]
374400
----
375401
pass:[explicit(B)]
376402
<<#ExplicitExpression-2constructor-04,ExplicitExpression>>(<<#ExplicitExpression,ExplicitExpression>> const&);
377403
----
378404

405+
[.small]#<<#ExplicitExpression-2constructor-04,_» more..._>>#
406+
379407
[source,cpp,subs="verbatim,macros,-callouts"]
380408
----
381409
pass:[explicit(B)]
382410
<<#ExplicitExpression-2constructor-08,ExplicitExpression>>(<<#ExplicitExpression,ExplicitExpression>>&&) noexcept;
383411
----
384412

413+
[.small]#<<#ExplicitExpression-2constructor-08,_» more..._>>#
414+
385415
[source,cpp,subs="verbatim,macros,-callouts"]
386416
----
387417
pass:[explicit(B)]
@@ -390,6 +420,8 @@ pass:[explicit(B)]
390420
int);
391421
----
392422

423+
[.small]#<<#ExplicitExpression-2constructor-02,_» more..._>>#
424+
393425
[#ExplicitExpression-2constructor-0b]
394426
== <<#ExplicitExpression,ExplicitExpression>>::ExplicitExpression
395427

0 commit comments

Comments
 (0)