|
9 | 9 | </div> |
10 | 10 | {% endmacro %} |
11 | 11 |
|
12 | | -{% macro function_definition_display(function, type2class, gen_path, prefix='') %} |
| 12 | +{% macro function_definition_display(function, type2href, type2class, gen_path, prefix='') %} |
13 | 13 | <div class="code code-definition {{ 'single-arg' if function['params'].__len__() <= 1 else '' }}">{% if function['self'] %}self.{% else %}{{ gen_path(function) }}{% endif %}<span |
14 | 14 | class="typ-func">{{ function['name'] }}</span>(<div class="arguments">{% for param in function['params'] %}<span |
15 | 15 | class="overview-param">{% if not param['positional'] %}<a href="#parameters-{{ param['name'] }}">{{ param['name'] |
16 | 16 | }}<!-- -->: </a>{% endif %}{% |
17 | | - for t in param['types'] %}<a href="/docs/reference/types/{{ t }}" class="pill {{ type2class(t) }}">{{ t }}</a>{% endfor %}{{',' if |
| 17 | + for t in param['types'] %}{% set href = type2href(t) %}{% if href %}<a href="/docs/reference/{{ type2href(t) }}" class="pill {{ type2class(t) }}">{{ t }}</a>{% else %}<span class="pill {{ type2class(t) }}">{{ t }}</span>{% endif %}{% endfor %}{{',' if |
18 | 18 | function['params'].__len__() > 1 else '' }} </span>{% endfor %}</div>) {% if function['returns'] %}<!-- -->-> {% for ret in function['returns'] |
19 | | - %}<a href="/docs/reference/types/{{ ret }}" class="pill {{ type2class(ret) }}">{{ ret }}</a>{% endfor %}{% endif %}</div> |
| 19 | + %}{% set href = type2href(t) %}{% if href %}<a href="/docs/reference/{{ type2href(ret) }}" class="pill {{ type2class(ret) }}">{{ ret }}</a>{% else %}<span class="pill {{ type2class(ret) }}">{{ ret }}</span>{% endif %}{% if not loop.last %}, {% endif %}{% endfor %}{% endif %}</div> |
20 | 20 | {% endmacro %} |
21 | 21 |
|
22 | | -{% macro function_params_display(function, type2class, gen_path, prefix='') %} |
| 22 | +{% macro function_params_display(function, type2href, type2class, gen_path, prefix='') %} |
23 | 23 | {% for param in function['params'] %} |
24 | 24 | <h4 id="{{ prefix }}-{{ function['name'] }}-parameters-{{ param['name'] }}"><code>{{ param['name'] }}</code> |
25 | 25 | <div class="additional-info"> |
26 | 26 | <div> |
27 | 27 | {% for t in param['types'] %} |
28 | | - <a href="/docs/reference/types/{{ t }}" class="pill {{ type2class(t) }}">{{ t }}</a> |
| 28 | + {% set href = type2href(t) %} |
| 29 | + {% if href %} |
| 30 | + <a href="/docs/reference/{{ href }}" class="pill {{ type2class(t) }}">{{ t }}</a> |
| 31 | + {% else %} |
| 32 | + <span class="pill {{ type2class(t) }}">{{ t }}</span> |
| 33 | + {% endif %} |
29 | 34 | {% endfor %} |
30 | 35 | </div> |
31 | 36 | {% if param['required'] %}<small>Required</small>{% endif %}{% if param['positional'] %}<small><span |
|
92 | 97 | {% endfor %} |
93 | 98 | {% endmacro %} |
94 | 99 |
|
95 | | -{% macro function_display(function, type2class, gen_path, prefix='', is_example_folding=true) %} |
| 100 | +{% macro function_display(function, type2href, type2class, gen_path, prefix='', is_example_folding=true) %} |
96 | 101 | {{ function['details'] | safe }} |
97 | | -{{ function_definition_display(function, type2class, gen_path, prefix) }} |
| 102 | +{{ function_definition_display(function, type2href, type2class, gen_path, prefix) }} |
98 | 103 | {% if function['example'] and is_example_folding %} |
99 | 104 | <details class="folding-example"> |
100 | 105 | <summary><img src="/assets/icons/16-arrow-right.svg" alt="" width="16" height="16">View example</summary> |
|
106 | 111 | {% if function['example'] and not is_example_folding %} |
107 | 112 | {{ function['example'] | safe }} |
108 | 113 | {% endif %} |
109 | | -{{ function_params_display(function, type2class, gen_path, prefix) }} |
| 114 | +{{ function_params_display(function, type2href, type2class, gen_path, prefix) }} |
110 | 115 | {% endmacro %} |
0 commit comments