Skip to content

Commit bc2055c

Browse files
committed
fix: multipage section levels
1 parent c194416 commit bc2055c

File tree

97 files changed

+1900
-1783
lines changed

Some content is hidden

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

97 files changed

+1900
-1783
lines changed

docs/modules/ROOT/pages/generators.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The multipage generator renders the layout multiple times as separate pages for
107107
The single-page generator renders the layout multiple times and concatenates the results in a single page.
108108

109109
Each time the generator encounters a symbol, it renders the layout template with the symbol data as the Handlebars context.
110-
The layout template can include other partial templates to render the symbol data.These partials are available in the `<addons>/generator/<generator>/partials` directory.
110+
The layout template can include other partial templates to render the symbol data. These partials are available in the `<addons>/generator/<generator>/partials` directory.
111111

112112
The Document Object Model (DOM) for each symbol includes all information about the symbol.One advantage of custom templates over post-processing XML files is the ability to access symbols as a graph.If symbol `A` refers to symbol `B`, some properties of symbol `B` are likely to be required in the documentation of `A`.All templates and generators can access a reference to `B` by searching the symbol tree or simply by accessing the elements `A` refers to.All references to other symbols are resolved in the templates.
113113

include/mrdocs/Support/Handlebars.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,17 @@ MRDOCS_DECL
11641164
void
11651165
registerLogicalHelpers(Handlebars& hbs);
11661166

1167+
/** Register math helpers into a Handlebars instance
1168+
1169+
This function registers a number of common helpers that perform
1170+
mathemathical operations.
1171+
1172+
@param hbs The Handlebars instance to register the helpers into
1173+
*/
1174+
MRDOCS_DECL
1175+
void
1176+
registerMathHelpers(Handlebars& hbs);
1177+
11671178
/** Register string helpers into a Handlebars instance
11681179
11691180
This function registers a number of common helpers that operate on
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
{{#if id}}[#{{id}}]
2+
{{/if}}
13
={{select level (repeat "=" level) (select @root.config.multipage "==" "=")}} {{> @partial-block }}

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{{! Single page documentation: symbol is not available to the wrapper but it's available here }}
33
{{! Include the symbol title at a higher level }}
44
[#{{{symbol.anchor}}}]
5-
== {{> symbol/qualified-name symbol }}
5+
{{#> markup/h level=1 id=anchor }}{{> symbol/qualified-name symbol }}{{/markup/h}}
66
{{/unless}}
77

88
{{! Brief }}
@@ -12,7 +12,7 @@
1212
{{/if}}
1313
{{! Synopsis }}
1414
{{#unless (contains (arr "namespace") symbol.kind)}}
15-
=={{#unless @root.config.multipage}}={{/unless}} Synopsis
15+
{{#> markup/dynamic-level-h }}Synopsis{{/markup/dynamic-level-h}}
1616

1717
{{>location/source dcl=(primary_location symbol)}}
1818

@@ -52,7 +52,7 @@
5252
{{else if symbol.members}}
5353
{{! Members }}
5454
{{#if (and symbol.members (ne symbol.kind "overloads"))}}
55-
=={{#unless @root.config.multipage}}={{/unless}} Members
55+
{{#> markup/dynamic-level-h }}Members{{/markup/dynamic-level-h}}
5656
5757
[,cols=2]
5858
|===
@@ -71,14 +71,14 @@
7171
{{/if}}
7272
{{! Description }}
7373
{{#if symbol.doc.description}}
74-
=={{#unless @root.config.multipage}}={{/unless}} Description
74+
{{#> markup/dynamic-level-h }}Description{{/markup/dynamic-level-h}}
7575
7676
{{symbol.doc.description}}
7777
7878
{{/if}}
7979
{{! Using symbols }}
8080
{{#if symbol.shadows}}
81-
=={{#unless @root.config.multipage}}={{/unless}} Introduced Symbols
81+
{{#> markup/dynamic-level-h }}Introduced Symbols{{/markup/dynamic-level-h}}
8282
8383
|===
8484
| Name
@@ -91,7 +91,7 @@
9191
{{! Exceptions }}
9292
{{#if (ne symbol.kind "overloads")}}
9393
{{#if symbol.doc.exceptions}}
94-
=={{#unless @root.config.multipage}}={{/unless}} Exceptions
94+
{{#> markup/dynamic-level-h }}Exceptions{{/markup/dynamic-level-h}}
9595
9696
|===
9797
| Name | Thrown on
@@ -106,7 +106,7 @@
106106
{{else}}
107107
{{#with (flattenUnique symbol.members "doc.exceptions" "exception") as |allExceptions|}}
108108
{{#if (ne (len allExceptions) 0)}}
109-
=={{#unless @root.config.multipage}}={{/unless}} Exceptions
109+
{{#> markup/dynamic-level-h }}Exceptions{{/markup/dynamic-level-h}}
110110
111111
|===
112112
| Name | Thrown on
@@ -122,15 +122,15 @@
122122
{{/if}}
123123
{{! Return value }}
124124
{{#if symbol.doc.returns}}
125-
=={{#unless @root.config.multipage}}={{/unless}} Return Value
125+
{{#> markup/dynamic-level-h }}Return Value{{/markup/dynamic-level-h}}
126126
127127
{{{symbol.doc.returns}}}
128128
129129
{{/if}}
130130
{{! Template Parameters }}
131131
{{#if (ne symbol.kind "overloads")}}
132132
{{#if symbol.doc.tparams}}
133-
=={{#unless @root.config.multipage}}={{/unless}} Template Parameters
133+
{{#> markup/dynamic-level-h }}Template Parameters{{/markup/dynamic-level-h}}
134134
135135
|===
136136
| Name | Description
@@ -145,7 +145,7 @@
145145
{{else}}
146146
{{#with (flattenUnique symbol.members "doc.tparams" "name") as |allTParams|}}
147147
{{#if (ne (len allTParams) 0)}}
148-
=={{#unless @root.config.multipage}}={{/unless}} Parameters
148+
{{#> markup/dynamic-level-h }}Parameters{{/markup/dynamic-level-h}}
149149
150150
|===
151151
| Name | Description
@@ -162,7 +162,7 @@
162162
{{! Parameters }}
163163
{{#if (ne symbol.kind "overloads")}}
164164
{{#if symbol.doc.params}}
165-
=={{#unless @root.config.multipage}}={{/unless}} Parameters
165+
{{#> markup/dynamic-level-h }}Parameters{{/markup/dynamic-level-h}}
166166
167167
|===
168168
| Name | Description
@@ -177,7 +177,7 @@
177177
{{else}}
178178
{{#with (flattenUnique symbol.members "doc.params" "name") as |allParams|}}
179179
{{#if (ne (len allParams) 0)}}
180-
=={{#unless @root.config.multipage}}={{/unless}} Parameters
180+
{{#> markup/dynamic-level-h }}Parameters{{/markup/dynamic-level-h}}
181181
182182
|===
183183
| Name | Description
@@ -193,7 +193,7 @@
193193
{{/if}}
194194
{{! Preconditions }}
195195
{{#if symbol.doc.preconditions}}
196-
=={{#unless @root.config.multipage}}={{/unless}} Preconditions
196+
{{#> markup/dynamic-level-h }}Preconditions{{/markup/dynamic-level-h}}
197197
198198
{{#each symbol.doc.preconditions}}
199199
{{{.}}}
@@ -202,7 +202,7 @@
202202
{{/if}}
203203
{{! Postconditions }}
204204
{{#if symbol.doc.postconditions}}
205-
=={{#unless @root.config.multipage}}={{/unless}} Postconditions
205+
{{#> markup/dynamic-level-h }}Postconditions{{/markup/dynamic-level-h}}
206206
207207
{{#each symbol.doc.postconditions}}
208208
{{{.}}}
@@ -211,7 +211,7 @@
211211
{{/if}}
212212
{{! See Also }}
213213
{{#if symbol.doc.see}}
214-
=={{#unless @root.config.multipage}}={{/unless}} See Also
214+
{{#> markup/dynamic-level-h }}See Also{{/markup/dynamic-level-h}}
215215
216216
{{#each symbol.doc.see}}
217217
{{{.}}}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{#> markup/h
2+
level=(select @root.config.multipage (or level 1) (add (or level 1) 1))
3+
id=id
4+
}}
5+
{{> @partial-block }}
6+
{{/markup/h}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<h{{or level 3}}{{#if class}} class="{{class}}"{{/if}}>{{> @partial-block }}</h{{or level 3}}>
1+
<h{{or level 3}}{{#if class}} class="{{class}}"{{/if}}{{#if id}} id="{{id}}"{{/if}}>{{> @partial-block }}</h{{or level 3}}>

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{{#unless @root.config.multipage }}
22
{{! Single page documentation: symbol is not available to the wrapper but it's available here }}
33
{{! Include the symbol title at a higher level }}
4-
<div id="{{{symbol.anchor}}}">
54
<div>
6-
<h2>{{> symbol/qualified-name symbol }}</h2>
5+
<div>
6+
{{#> markup/h level=2 id=symbol.anchor }}{{> symbol/qualified-name symbol }}{{/markup/h}}
77
{{/unless}}
88
{{! Brief }}
99
{{#if symbol.doc.brief}}
@@ -18,7 +18,7 @@
1818
{{! Synopsis }}
1919
{{#unless (contains (arr "namespace") symbol.kind)}}
2020
<div>
21-
<h3>Synopsis</h3>
21+
{{#> markup/dynamic-level-h level=2 }}Synopsis{{/markup/dynamic-level-h}}
2222
<div>
2323
{{>location/source dcl=(primary_location symbol)}}
2424
</div>
@@ -59,7 +59,7 @@
5959
{{! Members }}
6060
{{#if (and symbol.members (ne symbol.kind "overloads"))}}
6161
<div>
62-
<h3>Members</h3>
62+
{{#> markup/dynamic-level-h level=2 }}Members{{/markup/dynamic-level-h}}
6363
<table>
6464
<thead>
6565
<tr>
@@ -90,15 +90,15 @@
9090
{{! Description }}
9191
{{#if symbol.doc.description}}
9292
<div>
93-
<h3>Description</h3>
93+
{{#> markup/dynamic-level-h level=2 }}Description{{/markup/dynamic-level-h}}
9494
{{{symbol.doc.description}}}
9595

9696
</div>
9797
{{/if}}
9898
{{! Using symbols }}
9999
{{#if symbol.shadows}}
100100
<div>
101-
<h3>Introduced Symbols</h3>
101+
{{#> markup/dynamic-level-h level=2 }}Introduced Symbols{{/markup/dynamic-level-h}}
102102
<table>
103103
<thead>
104104
<tr>
@@ -120,7 +120,7 @@
120120
{{#if (ne symbol.kind "overloads")}}
121121
{{#if symbol.doc.exceptions}}
122122
<div>
123-
<h3>Exceptions</h3>
123+
{{#> markup/dynamic-level-h level=2 }}Exceptions{{/markup/dynamic-level-h}}
124124
<table>
125125
<thead>
126126
<tr>
@@ -143,7 +143,7 @@
143143
{{#with (flattenUnique symbol.members "doc.exceptions" "exception") as |allExceptions|}}
144144
{{#if (ne (len allExceptions) 0)}}
145145
<div>
146-
<h3>Exceptions</h3>
146+
{{#> markup/dynamic-level-h level=2 }}Exceptions{{/markup/dynamic-level-h}}
147147
<table>
148148
<thead>
149149
<tr>
@@ -167,15 +167,15 @@
167167
{{! Return value }}
168168
{{#if symbol.doc.returns}}
169169
<div>
170-
<h3>Return Value</h3>
170+
{{#> markup/dynamic-level-h level=2 }}Return Value{{/markup/dynamic-level-h}}
171171
{{{symbol.doc.returns}}}
172172
</div>
173173
{{/if}}
174174
{{! Template Parameters }}
175175
{{#if (ne symbol.kind "overloads")}}
176176
{{#if symbol.doc.tparams}}
177177
<div>
178-
<h3>Template Parameters</h3>
178+
{{#> markup/dynamic-level-h level=2 }}Template Parameters{{/markup/dynamic-level-h}}
179179
<table>
180180
<thead>
181181
<tr>
@@ -198,7 +198,7 @@
198198
{{#with (flattenUnique symbol.members "doc.tparams" "name") as |allTParams|}}
199199
{{#if (ne (len allTParams) 0)}}
200200
<div>
201-
<h3>Template Parameters</h3>
201+
{{#> markup/dynamic-level-h level=2 }}Template Parameters{{/markup/dynamic-level-h}}
202202
<table>
203203
<thead>
204204
<tr>
@@ -223,7 +223,7 @@
223223
{{#if (ne symbol.kind "overloads")}}
224224
{{#if symbol.doc.params}}
225225
<div>
226-
<h3>Parameters</h3>
226+
{{#> markup/dynamic-level-h level=2 }}Parameters{{/markup/dynamic-level-h}}
227227
<table>
228228
<thead>
229229
<tr>
@@ -246,7 +246,7 @@
246246
{{#with (flattenUnique symbol.members "doc.params" "name") as |allParams|}}
247247
{{#if (ne (len allParams) 0)}}
248248
<div>
249-
<h3>Parameters</h3>
249+
{{#> markup/dynamic-level-h level=2 }}Parameters{{/markup/dynamic-level-h}}
250250
<table>
251251
<thead>
252252
<tr>
@@ -270,7 +270,7 @@
270270
{{! Preconditions }}
271271
{{#if symbol.doc.preconditions}}
272272
<div>
273-
<h3>Preconditions</h3>
273+
{{#> markup/dynamic-level-h level=2 }}Preconditions{{/markup/dynamic-level-h}}
274274
{{#each symbol.doc.preconditions}}
275275
<p>{{.}}</p>
276276
{{/each}}
@@ -279,7 +279,7 @@
279279
{{! Postconditions }}
280280
{{#if symbol.doc.postconditions}}
281281
<div>
282-
<h3>Postconditions</h3>
282+
{{#> markup/dynamic-level-h level=2 }}Postconditions{{/markup/dynamic-level-h}}
283283
{{#each symbol.doc.postconditions}}
284284
<p>{{.}}</p>
285285
{{/each}}
@@ -288,7 +288,7 @@
288288
{{! See Also }}
289289
{{#if symbol.doc.see}}
290290
<div>
291-
<h3>See Also</h3>
291+
{{#> markup/dynamic-level-h level=2 }}See Also{{/markup/dynamic-level-h}}
292292
{{#each symbol.doc.see}}
293293
<p>{{.}}</p>
294294
{{/each}}

src/lib/Gen/hbs/Builder.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ Builder(
233233
helpers::registerStringHelpers(hbs_);
234234
helpers::registerAntoraHelpers(hbs_);
235235
helpers::registerLogicalHelpers(hbs_);
236+
helpers::registerMathHelpers(hbs_);
236237
helpers::registerContainerHelpers(hbs_);
237238
hbs_.registerHelper("relativize", dom::makeInvocable(relativize_fn));
238239

0 commit comments

Comments
 (0)