{%- import 'macros/getters.html' as get with context -%} {%- import 'macros/cards.html' as cards with context -%} {%- macro section_news(s) -%} {{ cards.cards_from_articles_or_pages(all_articles, max=s.num) }} {%- endmacro -%} {%- macro section_custom(s) -%} {{ cards.open() }} {%- for c in s.content -%} {{ cards.card(title=c[lang], url=c.url, catcolor=c.color) }} {%- endfor -%} {{ cards.close() }} {%- endmacro -%} {%- macro section_iframe(s) -%} {%- endmacro -%} {%- macro section_category(s) -%} {%- call(nativecat, sccat, catarticles) get.category_by_name(s.category) -%} {%- if s.title is not defined -%}

{{ sccat[lang]|e }}

{%- endif -%} {{ cards.cards_from_articles_or_pages(catarticles, max=s.num) }} {%- endcall -%} {%- endmacro -%} {%- macro section_tag(s) -%} {%- call(nativetag, sccat, tagarticles) get.tag_by_name(s.tag) -%} {%- if s.title is not defined -%}

{%- if sccat -%} {{- sccat[lang]|e -}} {%- else -%} {{- s.tag|e -}} {%- endif -%}

{%- endif -%} {{ cards.cards_from_articles_or_pages(tagarticles, max=s.num) }} {%- endcall -%} {%- endmacro -%} {%- macro section(s) -%} {%- if s.title is defined -%}

{{ s.title[lang]|e }}

{%- endif -%} {%- if s.type == "news" -%} {{ section_news(s) }} {%- elif s.type == "iframe" -%} {{ section_iframe(s) }} {%- elif s.type == "custom" -%} {{ section_custom(s) }} {%- elif s.type == "category" -%} {{ section_category(s) }} {%- elif s.type == "tag" -%} {{ section_tag(s) }} {%- else -%}
ERROR: render.section: Unknown section type: {{ s.type|e }}

{%- endif -%} {%- endmacro -%}