Skip to content

Commit 2da68d8

Browse files
committed
feat(HandlebarsGenerator): unify symbol partials
1 parent e33b47d commit 2da68d8

File tree

235 files changed

+17999
-35222
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+17999
-35222
lines changed

include/mrdocs/Support/Handlebars.hpp

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,96 @@ struct HandlebarsOptions
336336
337337
By default, an indented partial-call causes the output of the
338338
whole partial being indented by the same amount.
339+
340+
For instance, the partial:
341+
342+
@code{.handlebars}
343+
A
344+
B
345+
C
346+
@endcode
347+
348+
and the template:
349+
350+
@code{.handlebars}
351+
<div>
352+
{{> partial}}
353+
</div>
354+
@endcode
355+
356+
will render as:
357+
358+
@code{.html}
359+
<div>
360+
A
361+
B
362+
C
363+
</div>
364+
@endcode
365+
366+
because the partial is indented by the same amount as the
367+
partial call.
368+
369+
This can be disabled by setting this option to true. In this case,
370+
the partial above would be rendered as:
371+
372+
@code{.html}
373+
<div>
374+
A
375+
B
376+
C
377+
</div>
378+
379+
339380
*/
340381
bool preventIndent = false;
341382

342383
/** Disables standalone tag removal when set to true
343384
385+
By default, Handlebars removes whitespace around block and partial
386+
expressions. For instance, the partial:
387+
388+
@code{.handlebars}
389+
A
390+
@endcode
391+
392+
and the template:
393+
394+
@code{.handlebars}
395+
<div>
396+
{{> partial}}
397+
</div>
398+
@endcode
399+
400+
will render as:
401+
402+
@code{.html}
403+
<div>
404+
A</div>
405+
@endcode
406+
407+
because the whitespace up to the newline after the partial is removed.
408+
409+
A double newline is required to ensure that the whitespace is not
410+
removed. For instance, the template:
411+
412+
@code{.handlebars}
413+
<div>
414+
{{> partial}}
415+
416+
</div>
417+
@endcode
418+
419+
will render as:
420+
421+
@code{.html}
422+
<div>
423+
A
424+
</div>
425+
@endcode
426+
427+
This can be disabled by setting this option to true.
428+
344429
When set, blocks and partials that are on their own line will not
345430
remove the whitespace on that line.
346431
*/
Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
[#{{{symbol.anchor}}}]
2+
={{#unless @root.config.multipage}}={{/unless}} {{#unless (eq symbol.kind "friend")}}{{#if symbol.name}}{{>types/nested-name-specifier symbol=symbol.parent includeNamespace=true}}{{symbol.name}}{{else}}{{#if symbol.parent}}Unnamed{{else}}Global{{/if}} {{or symbol.tag symbol.kind}}{{/if}}{{else}}{{#if symbol.symbol.name}}{{>types/nested-name-specifier symbol=symbol.symbol.parent includeNamespace=true}}{{symbol.symbol.name}}{{else}}{{symbol.type.name}}{{/if}}{{/unless}}
3+
4+
{{! Brief }}
5+
{{#if symbol.doc.brief}}
6+
{{{symbol.doc.brief}}}
7+
8+
{{/if}}
9+
{{! Synopsis }}
10+
{{#unless (contains (arr "namespace") symbol.kind)}}
11+
=={{#unless @root.config.multipage}}={{/unless}} Synopsis
12+
13+
{{>types/source dcl=(primary_location symbol)}}
14+
15+
{{#if (ne symbol.kind "overloads")}}
16+
[source,cpp,subs="verbatim,macros,-callouts"]
17+
----
18+
{{> signature }}
19+
20+
----
21+
22+
{{else}}
23+
{{#each symbol.members as | member |}}
24+
[source,cpp,subs="verbatim,macros,-callouts"]
25+
----
26+
{{> signature symbol=member link=member}}
27+
28+
----
29+
30+
{{/each}}
31+
{{/if}}
32+
{{/unless}}
33+
{{! Tranches }}
34+
{{#if symbol.interface}}
35+
{{#if (eq symbol.kind "record")}}
36+
{{#with symbol.interface}}
37+
{{>types/tranche tranche=public label="" is-namespace=false}}
38+
39+
{{>types/tranche tranche=protected label="Protected" is-namespace=false}}
40+
41+
{{>types/tranche tranche=private label="Private" is-namespace=false}}
42+
43+
{{/with}}
44+
{{else}}
45+
{{>types/tranche tranche=symbol.interface label="" is-namespace=true}}
46+
47+
{{/if}}
48+
{{else if symbol.members}}
49+
{{! Members }}
50+
{{#if (and symbol.members (ne symbol.kind "overloads"))}}
51+
=={{#unless @root.config.multipage}}={{/unless}} Members
52+
53+
[,cols=2]
54+
|===
55+
|Name |Description
56+
{{#each symbol.members}}
57+
|xref:{{{anchor}}}[`pass:v[{{>types/declarator-id . nolink=true}}]`] | {{~doc.brief}}
58+
{{/each}}
59+
|===
60+
61+
{{/if}}
62+
{{/if}}
63+
{{! Using directives }}
64+
{{#if symbol.usingDirectives}}
65+
{{>types/info-list members=symbol.usingDirectives title="Using Directives"}}
66+
67+
{{/if}}
68+
{{! Description }}
69+
{{#if symbol.doc.description}}
70+
=={{#unless @root.config.multipage}}={{/unless}} Description
71+
72+
{{symbol.doc.description}}
73+
74+
{{/if}}
75+
{{! Using symbols }}
76+
{{#if symbol.shadows}}
77+
=={{#unless @root.config.multipage}}={{/unless}} Introduced Symbols
78+
79+
|===
80+
| Name
81+
{{#each symbol.shadows}}
82+
| {{name}}
83+
{{/each}}
84+
|===
85+
86+
{{/if}}
87+
{{! Exceptions }}
88+
{{#if (ne symbol.kind "overloads")}}
89+
{{#if symbol.doc.exceptions}}
90+
=={{#unless @root.config.multipage}}={{/unless}} Exceptions
91+
92+
|===
93+
| Name | Thrown on
94+
95+
{{#each symbol.doc.exceptions}}
96+
| `{{exception}}`
97+
| {{description}}
98+
{{/each}}
99+
|===
100+
101+
{{/if}}
102+
{{else}}
103+
{{#with (flattenUnique symbol.members "doc.exceptions" "exception") as |allExceptions|}}
104+
{{#if (ne (len allExceptions) 0)}}
105+
=={{#unless @root.config.multipage}}={{/unless}} Exceptions
106+
107+
|===
108+
| Name | Thrown on
109+
110+
{{#each allExceptions as |exception|}}
111+
| `{{exception.exception}}`
112+
| {{{exception.description}}}
113+
{{/each}}
114+
|===
115+
116+
{{/if}}
117+
{{/with}}
118+
{{/if}}
119+
{{! Return value }}
120+
{{#if symbol.doc.returns}}
121+
=={{#unless @root.config.multipage}}={{/unless}} Return Value
122+
123+
{{{symbol.doc.returns}}}
124+
125+
{{/if}}
126+
{{! Template Parameters }}
127+
{{#if (ne symbol.kind "overloads")}}
128+
{{#if symbol.doc.tparams}}
129+
=={{#unless @root.config.multipage}}={{/unless}} Template Parameters
130+
131+
|===
132+
| Name | Description
133+
134+
{{#each symbol.doc.tparams}}
135+
| *{{name}}*
136+
| {{description}}
137+
{{/each}}
138+
|===
139+
140+
{{/if}}
141+
{{else}}
142+
{{#with (flattenUnique symbol.members "doc.tparams" "name") as |allTParams|}}
143+
{{#if (ne (len allTParams) 0)}}
144+
=={{#unless @root.config.multipage}}={{/unless}} Parameters
145+
146+
|===
147+
| Name | Description
148+
149+
{{#each allTParams as |param|}}
150+
| *{{param.name}}*
151+
| {{param.description}}
152+
{{/each}}
153+
|===
154+
155+
{{/if}}
156+
{{/with}}
157+
{{/if}}
158+
{{! Parameters }}
159+
{{#if (ne symbol.kind "overloads")}}
160+
{{#if symbol.doc.params}}
161+
=={{#unless @root.config.multipage}}={{/unless}} Parameters
162+
163+
|===
164+
| Name | Description {{! TODO: | Type? }}
165+
166+
{{#each symbol.doc.params}}
167+
| *{{name}}*
168+
| {{description}}
169+
{{/each}}
170+
|===
171+
172+
{{/if}}
173+
{{else}}
174+
{{#with (flattenUnique symbol.members "doc.params" "name") as |allParams|}}
175+
{{#if (ne (len allParams) 0)}}
176+
=={{#unless @root.config.multipage}}={{/unless}} Parameters
177+
178+
|===
179+
| Name | Description {{! TODO: | Type? }}
180+
181+
{{#each allParams as |param|}}
182+
| *{{param.name}}*
183+
| {{param.description}}
184+
{{/each}}
185+
|===
186+
187+
{{/if}}
188+
{{/with}}
189+
{{/if}}
190+
{{! Preconditions }}
191+
{{#if symbol.doc.preconditions}}
192+
=={{#unless @root.config.multipage}}={{/unless}} Preconditions
193+
194+
{{#each symbol.doc.preconditions}}
195+
{{{.}}}
196+
{{/each}}
197+
198+
{{/if}}
199+
{{! Postconditions }}
200+
{{#if symbol.doc.postconditions}}
201+
=={{#unless @root.config.multipage}}={{/unless}} Postconditions
202+
203+
{{#each symbol.doc.postconditions}}
204+
{{{.}}}
205+
{{/each}}
206+
207+
{{/if}}
208+
{{! See Also }}
209+
{{#if symbol.doc.see}}
210+
=={{#unless @root.config.multipage}}={{/unless}} See Also
211+
212+
{{#each symbol.doc.see}}
213+
{{{.}}}
214+
215+
{{/each}}
216+
217+
{{/if}}

share/mrdocs/addons/generator/adoc/partials/symbols/alias.adoc.hbs

Lines changed: 0 additions & 31 deletions
This file was deleted.

share/mrdocs/addons/generator/adoc/partials/symbols/concept.adoc.hbs

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)