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

(cherry picked from commit 5d6a040fc3)
release-v2.4.0
Francisco Giordano 5 years ago
parent f5fe378cc6
commit 9df4f7971e
  1. 77
      docs/contract.hbs

@ -1,6 +1,10 @@
{{#linkable}} {{~#*inline "typed-variable-array"~}}
{{#each .}}[.var-type\]#{{typeName}}#{{#if name}} [.var-name\]#{{name}}#{{/if}}{{#unless @last}}, {{/unless}}{{/each}}
{{~/inline~}}
{{#each linkable}}
:{{name}}: pass:normal[xref:#{{anchor}}[`{{name}}`]] :{{name}}: pass:normal[xref:#{{anchor}}[`{{name}}`]]
{{/linkable}} {{/each}}
[.contract] [.contract]
[[{{anchor}}]] [[{{anchor}}]]
@ -11,56 +15,77 @@
{{#if modifiers}} {{#if modifiers}}
[.contract-index] [.contract-index]
.Modifiers .Modifiers
{{#inheritance}} --
{{#ownModifiers}} {{#each inheritedItems}}
* xref:#{{anchor}}[`{{signature}}`] {{#unless @first}}
{{/ownModifiers}} [.contract-subindex-inherited]
{{/inheritance}} .{{contract.name}}
{{/unless}}
{{#each modifiers}}
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
{{/each}}
{{/each}}
--
{{/if}} {{/if}}
{{#if functions}} {{#if functions}}
[.contract-index] [.contract-index]
.Functions .Functions
{{#inheritance}} --
{{#ownFunctions}} {{#each inheritedItems}}
* xref:#{{anchor}}[`{{signature}}`] {{#unless @first}}
{{/ownFunctions}} [.contract-subindex-inherited]
{{/inheritance}} .{{contract.name}}
{{/unless}}
{{#each functions}}
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
{{/each}}
{{/each}}
--
{{/if}} {{/if}}
{{#if events}} {{#if events}}
[.contract-index] [.contract-index]
.Events .Events
{{#inheritance}} --
{{#ownEvents}} {{#each inheritedItems}}
* xref:#{{anchor}}[`{{signature}}`] {{#unless @first}}
{{/ownEvents}} [.contract-subindex-inherited]
{{/inheritance}} .{{contract.name}}
{{/unless}}
{{#each events}}
* xref:#{{anchor}}[`{{name}}({{args.names}})`]
{{/each}}
{{/each}}
--
{{/if}} {{/if}}
{{#ownModifiers}} {{#each modifiers}}
[.contract-item] [.contract-item]
[[{{anchor}}]] [[{{anchor}}]]
==== `{{name}}({{args}})` ==== `pass:normal[{{name}}({{> typed-variable-array args}})]`
{{natspec.devdoc}} {{natspec.devdoc}}
{{/ownModifiers}} {{/each}}
{{#ownFunctions}} {{#each functions}}
[.contract-item] [.contract-item]
[[{{anchor}}]] [[{{anchor}}]]
==== `{{name}}({{args}}){{#if outputs}}{{outputs}}{{/if}}` [.visibility]#{{visibility}}# ==== `pass:normal[{{name}}({{> typed-variable-array args}}){{#if outputs}}{{> typed-variable-array outputs}}{{/if}}]` [.visibility]#{{visibility}}#
{{natspec.devdoc}} {{natspec.devdoc}}
{{/ownFunctions}} {{/each}}
{{#ownEvents}} {{#each events}}
[.contract-item] [.contract-item]
[[{{anchor}}]] [[{{anchor}}]]
==== `{{name}}({{args}})` ==== `pass:normal[{{name}}({{> typed-variable-array args}})]`
{{natspec.devdoc}} {{natspec.devdoc}}
{{/ownEvents}} {{/each}}

Loading…
Cancel
Save