lektor-website/templates/macros/docs.html

50 lines
1.7 KiB
HTML
Raw Normal View History

2015-12-19 14:52:17 +01:00
{% macro get_doc_icon(page) -%}
{% if page.type == 'method' or page.type == 'function' or page.type == 'filter' -%}
<i class="glyphicon glyphicon-cog"></i>
{%- elif page.type == 'property' -%}
<i class="glyphicon glyphicon-info-sign"></i>
{%- elif page.type == 'operator' -%}
<i class="glyphicon glyphicon-flash"></i>
{%- elif page.type == 'class' -%}
<i class="glyphicon glyphicon-leaf"></i>
{%- elif page.type == 'cmdlet' -%}
<i class="glyphicon glyphicon-console"></i>
{%- elif page.type == 'event' -%}
<i class="glyphicon glyphicon-flash"></i>
2015-12-25 22:53:37 +01:00
{%- elif page.type == 'type' or page.type == 'sysfield' -%}
2015-12-19 14:52:17 +01:00
<i class="glyphicon glyphicon-pencil"></i>
{%- else -%}
<i class="glyphicon glyphicon-list-alt"></i>
{%- endif %}
{%- endmacro %}
{% macro get_doc_link(page) -%}
<a href="{{ page|url }}">
{{- page.title -}}{% if page.type in ('function', 'method') %}(){% endif -%}
</a>
2015-12-19 14:52:17 +01:00
{%- endmacro %}
{% macro get_doc_header(page) %}
{% if page.type %}
<h1>
{%- if page.type %}{{ get_doc_icon(page) }} {% endif %}
{%- if page.module %}<code class="mod">{{ page.module }}.</code>{% endif -%}
<code class="obj">{{ page.title }}</code>
{%- if page.signature or page.type in ('method', 'function', 'filter', 'event') %}
<span class="sig">({{ format_signature(page.signature) }})</span>
{%- endif -%}
</h1>
2015-12-19 14:52:17 +01:00
{% else %}
<h1>{{ page.title }}</h1>
{% endif %}
{% endmacro %}
{% macro format_signature(signature) -%}
{% if signature|trim -%}
{% set sep = joiner(" ") -%}
{% for param in signature.split(',')|map('trim') -%}
{{ sep() }}<code>{{ param }}{% if not loop.last %},{% endif %}</code>
{%- endfor -%}
{% endif -%}
{% endmacro %}