Skip to content

Commit 5d6a040

Browse files
authored
Design tweaks to documentation template (#1937)
* switch index to show arg names * add index separators * add classes to style variable type and name * add class for inherited part of index * use inheritedItems in contracts template * refactor template to use explicit if and each
1 parent e557a54 commit 5d6a040

File tree

1 file changed

+51
-26
lines changed

1 file changed

+51
-26
lines changed

docs/contract.hbs

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
{{#linkable}}
1+
{{~#*inline "typed-variable-array"~}}
2+
{{#each .}}[.var-type\]#{{typeName}}#{{#if name}} [.var-name\]#{{name}}#{{/if}}{{#unless @last}}, {{/unless}}{{/each}}
3+
{{~/inline~}}
4+
5+
{{#each linkable}}
26
:{{name}}: pass:normal[xref:#{{anchor}}[`{{name}}`]]
3-
{{/linkable}}
7+
{{/each}}
48

59
[.contract]
610
[[{{anchor}}]]
@@ -11,56 +15,77 @@
1115
{{#if modifiers}}
1216
[.contract-index]
1317
.Modifiers
14-
{{#inheritance}}
15-
{{#ownModifiers}}
16-
* xref:#{{anchor}}[`{{signature}}`]
17-
{{/ownModifiers}}
18-
{{/inheritance}}
18+
--
19+
{{#each inheritedItems}}
20+
{{#unless @first}}
21+
[.contract-subindex-inherited]
22+
.{{contract.name}}
23+
{{/unless}}
24+
{{#each modifiers}}
25+
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
26+
{{/each}}
27+
28+
{{/each}}
29+
--
1930
{{/if}}
2031

2132
{{#if functions}}
2233
[.contract-index]
2334
.Functions
24-
{{#inheritance}}
25-
{{#ownFunctions}}
26-
* xref:#{{anchor}}[`{{signature}}`]
27-
{{/ownFunctions}}
28-
{{/inheritance}}
35+
--
36+
{{#each inheritedItems}}
37+
{{#unless @first}}
38+
[.contract-subindex-inherited]
39+
.{{contract.name}}
40+
{{/unless}}
41+
{{#each functions}}
42+
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
43+
{{/each}}
44+
45+
{{/each}}
46+
--
2947
{{/if}}
3048

3149
{{#if events}}
3250
[.contract-index]
3351
.Events
34-
{{#inheritance}}
35-
{{#ownEvents}}
36-
* xref:#{{anchor}}[`{{signature}}`]
37-
{{/ownEvents}}
38-
{{/inheritance}}
52+
--
53+
{{#each inheritedItems}}
54+
{{#unless @first}}
55+
[.contract-subindex-inherited]
56+
.{{contract.name}}
57+
{{/unless}}
58+
{{#each events}}
59+
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
60+
{{/each}}
61+
62+
{{/each}}
63+
--
3964
{{/if}}
4065

41-
{{#ownModifiers}}
66+
{{#each modifiers}}
4267
[.contract-item]
4368
[[{{anchor}}]]
44-
==== `{{name}}({{args}})`
69+
==== `pass:normal[{{name}}({{> typed-variable-array args}})]`
4570

4671
{{natspec.devdoc}}
4772

48-
{{/ownModifiers}}
73+
{{/each}}
4974

50-
{{#ownFunctions}}
75+
{{#each functions}}
5176
[.contract-item]
5277
[[{{anchor}}]]
53-
==== `{{name}}({{args}}){{#if outputs}}{{outputs}}{{/if}}` [.visibility]#{{visibility}}#
78+
==== `pass:normal[{{name}}({{> typed-variable-array args}}){{#if outputs}}{{> typed-variable-array outputs}}{{/if}}]` [.visibility]#{{visibility}}#
5479

5580
{{natspec.devdoc}}
5681

57-
{{/ownFunctions}}
82+
{{/each}}
5883

59-
{{#ownEvents}}
84+
{{#each events}}
6085
[.contract-item]
6186
[[{{anchor}}]]
62-
==== `{{name}}({{args}})`
87+
==== `pass:normal[{{name}}({{> typed-variable-array args}})]`
6388

6489
{{natspec.devdoc}}
6590

66-
{{/ownEvents}}
91+
{{/each}}

0 commit comments

Comments
 (0)