Skip to content
Snippets Groups Projects
Verified Commit 51f00afd authored by Jake's avatar Jake
Browse files

added renderers.html

parent 6e6a5064
No related branches found
No related tags found
No related merge requests found
{%- import 'macros/getters.html' as get with context -%}
{%- import 'macros/cards.html' as cards with context -%}
{%- macro section_news(s) -%}
{{ cards.open() }}
{%- for article in all_articles -%}
{%- if loop.index < s.num -%}
{{ cards.card_from_article_or_page(article) }}
{%- endif -%}
{%- endfor -%}
{{ cards.close() }}
{%- 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) -%}
<iframe src="{{ s.url }}"></iframe>
{%- endmacro -%}
{%- macro section_category(s) -%}
{%- call(nativecat, sccat, catarticles) get.category_by_name(s.category) -%}
{%- if s.title is not defined -%}
<header>
<h2 {% if s.id is defined -%}id="{{ s.id }}"{%- endif %}>{{ sccat[lang]|e }}</h2>
</header>
{%- endif -%}
{{ cards.open() }}
{%- for article in catarticles -%}
{%- if loop.index < s.num -%}
{{ cards.card_from_article_or_page(article) }}
{%- endif -%}
{%- endfor -%}
{{ cards.close() }}
{%- endcall -%}
{%- endmacro -%}
{%- macro section_tag(s) -%}
{%- call(nativetag, sccat, tagarticles) get.tag_by_name(s.tag) -%}
{%- if s.title is not defined -%}
<header>
<h2 {% if s.id is defined -%}id="{{ s.id }}"{%- endif %}>{{ s.tag|e }}</h2>
</header>
{%- endif -%}
{{ cards.open() }}
{%- for article in tagarticles -%}
{%- if loop.index < s.num -%}
{{ cards.card_from_article_or_page(article) }}
{%- endif -%}
{%- endfor -%}
{{ cards.close() }}
{%- endcall -%}
{%- endmacro -%}
{%- macro section(s) -%}
{%- if s.title is defined -%}
<header>
<h2 {% if s.id is defined -%}id="{{ s.id }}"{%- endif %}>{{ s.title[lang]|e }}</h2>
</header>
{%- 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 -%}
<br />
<strong>ERROR: render.section: Unknown section type: {{ s.type|e }}</strong><br />
<br />
{%- endif -%}
{%- endmacro -%}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment