refactor: use macro to generate sections
This commit is contained in:
parent
1cfc786947
commit
7ecd173dab
|
|
@ -0,0 +1,11 @@
|
|||
{% macro section(title, title_image, title_image_hover) -%}
|
||||
<div class="section"
|
||||
style="
|
||||
--image:url('{{ title_image }}');
|
||||
--hover-image:url('{{ title_image_over or title_image }}');
|
||||
"
|
||||
>
|
||||
<h2 class="section--title">{{ title }}</h2>
|
||||
{{ caller() }}
|
||||
</div>
|
||||
{%- endmacro -%}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<div class="section"
|
||||
style="
|
||||
--image:url('{{ title_image }}');
|
||||
--hover-image:url('{{ title_image_over or title_image }}');
|
||||
"
|
||||
>
|
||||
<h2 class="section--title">{{ title }}</h2>
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
{% set title = gettext("Games") %}
|
||||
{% set title_image = "/img/section-games.png" %}
|
||||
{% from "lib/section.html" import section %}
|
||||
|
||||
{% extends "lib/section.html.j2" %}
|
||||
|
||||
{% block content %}
|
||||
{% call section(gettext("Games"), "/img/section-games.png") %}
|
||||
{% for game in glob("games/*.md") | map('markdown') %}
|
||||
<div class="game">
|
||||
<div class="game--picture-wrapper">
|
||||
|
|
@ -20,5 +17,5 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% endcall %}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
{% set title = "News" %}
|
||||
{% set title_image = "/img/section-news.png" %}
|
||||
{% from "lib/section.html" import section %}
|
||||
|
||||
{% extends "lib/section.html.j2" %}
|
||||
|
||||
{% block content %}
|
||||
{% call section(gettext("News"), "/img/section-news.png") %}
|
||||
{% for news in glob("news/*.md") | map('markdown') %}
|
||||
<div class="news">
|
||||
<div class="news--title">
|
||||
|
|
@ -18,4 +15,4 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
{% endcall %}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
{% set title = "Frog Collective" %}
|
||||
{% set title_image = "/img/section-collective.png" %}
|
||||
{% set title_image_hover = "/img/section-collective-hover.png" %}
|
||||
{% from "lib/section.html" import section %}
|
||||
|
||||
{% extends "lib/section.html.j2" %}
|
||||
|
||||
{% block content %}
|
||||
{% call section(gettext("Collective"), "/img/section-collective.png", "/img/section-collective-hover.png") %}
|
||||
<p>
|
||||
{% trans %}
|
||||
Welcome to the cozy world of the Frog Collective, where big dreams come
|
||||
|
|
@ -53,4 +49,4 @@
|
|||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% endcall %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue