{%- import 'macros/getters.html' as get with context -%} {%- import 'macros/cards.html' as cards with context -%} {%- import 'macros/content_renderer.html' as content_renderer with context -%} {%- macro section_news(s, lang) -%} {{ cards.cards_from_pages(pages_modified, max=s.num) }} {%- endmacro -%} {%- macro section_custom(s, lang) -%} {{ cards.open() }} {%- for c in s.content -%} {%- if c is string -%} {{ cards.card_from_link(url=c, lang=lang) }} {%- else -%} {{ cards.card(title=c[lang], url=c.url, catcolor=c.color, lang=lang) }} {%- endif -%} {%- endfor -%} {{ cards.close() }} {%- endmacro -%} {%- macro section_iframe(s, lang) -%} {%- endmacro -%} {%- macro section_tag(s, lang) -%} {%- call(tagtitle, tagcolor, tagurl, tagpage, tagpages) get.tag_by_name(s.tag, lang) -%} {%- if s.title is not defined -%}

{{ tagtitle|e }}

{%- endif -%} {{ cards.cards_from_pages(tagpages, lang, max=s.num) }} {%- if tagpage -%} {{ content_renderer.render_content(tagpage.content, lang) }} {%- endif -%} {%- endcall -%} {%- endmacro -%} {%- macro section(s, lang) -%} {%- if s.title is defined -%}

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

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

{%- endif -%} {%- endmacro -%} {%- macro sections(sl, lang) -%} {%- for s in sl -%}
{{ section(s, lang) }}
{%- endfor -%} {%- endmacro -%}