{# SPDX-License-Identifier: CC0-1.0 koszko.org website base page template. Copyright (C) 2022 Wojtek Kosior #} {% macro same_lang_url(page_path) -%} {{ url_for('.show_page_in_' ~ lang_short, page_path=page_path) }} {%- endmacro %} {% set section_ns = namespace( in_section = false, id = none, linked = false, first = true ) %} {% macro maybe_link(to, link=true) %} {%- if to is not none and link -%} {{ caller() }} {%- else -%} {{ caller() }} {%- endif -%} {% endmacro %} {% macro header(level, text='', link_to_section=true) %} {% set should_link = section_ns.in_section and link_to_section and not section_ns.linked and section_ns.id is not none %} {% set section_ns.linked = section_ns.linked or should_link %} {% set caller_markup = caller() if caller is defined else '' %} {% call maybe_link('#' ~ section_ns.id, link=should_link) -%} {{ text }}{{ caller_markup }} {%- endcall %} {% endmacro %} {% macro section(id=none) %} {% set attrs = {} %} {% do attrs.update(section_attrs|default({})) %} {% if section_ns.first %} {% set section_ns.first = false %} {% set classes = attrs.get('class') %} {% set classes = (classes ~ ' ' if classes else '') ~ 'first-section' %} {% do attrs.update({'class': classes}) %} {% endif %} {% if id is not none %} {% endif %} {% if section_ns.in_section %} {{ raise_exception('Section defined inside another section.') }} {% else %} {% set section_ns.in_section = true %} {% set section_ns.id = id %} {% set section_ns.linked = false %} {% endif %} {{ caller() }} {% set section_ns.in_section = false %} {% endmacro %} {% macro para(ensure_containing_section=true) %} {% if section_ns.in_section or not ensure_containing_section %}

{{ caller() }}

{% else %} {% set caller_snapshot = caller %} {% call section() %}

{{ caller_snapshot() }}

{% endcall %} {% endif %} {% endmacro %} {% macro link(to, text='') -%} {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%} {%- endmacro %} {% macro bold(text='') -%} {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%} {%- endmacro %} {% macro italic(text='') -%} {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%} {%- endmacro %} {% macro unordered_list() %}
    {{ caller() }}
{% endmacro %} {% macro list_entry() %}
  • {{ caller() }}
  • {% endmacro %} {% macro descriptions() %}
    {{ caller() }}
    {% endmacro %} {% macro desc_term(text='') %} {{ '
    '|safe }}
    {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%}
    {% endmacro %} {% macro desc_desc(text='') %}
    {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%}
    {{ '
    '|safe }} {% endmacro %} {% macro img(url, alt_text, extra_classes=[]) %} {% set attrs = {'class': (['pure-img'] + extra_classes)|join(' ')} %} {% do attrs.update({'src': url, 'alt': alt_text, 'draggable': false}) %} {% endmacro %} {% macro aside(text='') %} {% endmacro %} {% macro sup(text='') -%} {{ text }} {%- if caller is defined -%} {{ caller() }} {%- endif -%} {%- endmacro %} {% set numberlinks_ns = namespace(next_num=1, nums={}) %} {% macro numberlink(link_url) -%} {%- if link_url not in numberlinks_ns.nums -%} {%- do numberlinks_ns.nums.update({link_url: numberlinks_ns.next_num}) -%} {%- set numberlinks_ns.next_num = numberlinks_ns.next_num + 1 -%} {%- endif -%} {%- call sup() -%} {{ link(link_url, '[' ~ numberlinks_ns.nums[link_url] ~ ']') }} {%- endcall -%} {%- endmacro %} {% macro newline() %}
    {% endmacro %} {% macro nbsp() -%}   {%- endmacro %} {% macro unicode(code) -%} &#{{ code }}; {%- endmacro %} {% block head %} {% block title %} {% endblock %} {% block external_css %} {% endblock %} {% endblock %} {% block body %} Kocham Asię Ɛ> {% endblock %}