2
schangxiang@126.com
2024-08-16 b47c50a2a514def7374b32d7194b2c599cba5625
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{% macro typeList(types) -%}
{% for typeName in types %}<a href="" class="{$ typeName | typeClass $}">{$ typeName | escape $}</a>{% endfor %}
{%- endmacro -%}
 
{%- macro paramTable(params) %}
<table class="table">
  <thead>
    <tr>
      <th>Param</th>
      <th>Type</th>
      <th>Details</th>
    </tr>
  </thead>
  <tbody>
    {% for param in params %}
    <tr>
      <td>
        {$ param.name $}
        {% if param.alias %}| {$ param.alias $}{% endif %}
        {% if param.optional %}<div><em>(optional)</em></div>{% endif %}
      </td>
      <td>
        {$ typeList(param.typeList) $}
      </td>
      <td>
        {$ param.description | marked $}
        {% if param.defaultValue %}<p><em>(default: {$ param.defaultValue $})</em></p>{% endif %}
      </td>
    </tr>
    {% endfor %}
  </tbody>
</table>
{% endmacro -%}
 
 
{%- macro directiveParam(name, type, join, sep) %}
  {%- if type.optional %}[{% endif -%}
  {$ name | dashCase $}{$ join $}{$ type.description $}{$ sep $}
  {%- if type.optional %}]{% endif -%}
{% endmacro -%}
 
{%- macro functionSyntax(fn) %}
  {%- set sep = joiner(', ') -%}
  {% marked -%}
    `{$ fn.name $}({%- for param in fn.params %}{$ sep() $}
    {%- if param.type.optional %}[{% endif -%}
    {$ param.name $}
    {%- if param.type.optional %}]{% endif -%}
    {% endfor %});`
  {%- endmarked %}
{% endmacro -%}
 
{%- macro typeInfo(fn) -%}
<table class="variables-matrix return-arguments">
  <tr>
    <td>{$ typeList(fn.typeList) $}</td>
    <td>{$ fn.description | marked $}</td>
  </tr>
</table>
{%- endmacro -%}