more options for the formatting of entries in the static website
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
<link rel="stylesheet" href="{{ base['url_to']('css/bulma.min.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
{# navigation bar -#}
|
||||
<nav class="navbar container is-light" role="navigation" aria-label="main navigation">
|
||||
<div class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
@ -29,7 +30,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{# content block -#}
|
||||
{% block content %}{% endblock %}
|
||||
{# footer -#}
|
||||
<footer class="footer">
|
||||
<div class="container is-size-7">
|
||||
<a href="https://trilarion.blogspot.com/search/label/osgames">Blog</a><br>
|
||||
|
@ -4,9 +4,9 @@
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<div class="box">
|
||||
<div class="block"><h1 class="title">{{ index['title'] }}</h1></div>
|
||||
<div class="block"><h1 class="title is-size-4">{{ index['title'] }}</h1></div>
|
||||
{% set comma = joiner(", ") %}
|
||||
<div class="is-size-4">
|
||||
<div class="is-size-5">
|
||||
{% for category in index['categories'] -%}
|
||||
{{ comma() }} <a href="#{{ category }}" class="has-text-weight-semibold">{{ category }}</a> ({{ index['number_entries'][category] }})
|
||||
{%- endfor %}
|
||||
@ -20,7 +20,7 @@
|
||||
<div class="column">
|
||||
<ul>
|
||||
{% for entry in entries_column %}
|
||||
<li>{{ macros.url(entry['href'], entry['name']) }} {% if 'tags' in entry %}<span class="is-light is-size-7">({{ entry['tags'] }})</span>{% endif %}</li>
|
||||
<li>{{ macros.render_url(entry['url']) }} {% if 'tags' in entry %}{{ macros.render_text(entry['tags']) }}{% endif %}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -3,8 +3,10 @@
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
<h1 class="title">{{ listing['title'] }}</h1>
|
||||
{# iterate over items -#}
|
||||
{% for item in listing['items'] %}
|
||||
<div class="box">
|
||||
{# item header with anchor, name and link to contribute -#}
|
||||
<nav class="level is-mobile">
|
||||
<div class="level-left">
|
||||
<h2 id="{{ item['anchor-id'] }}" class="title is-4">{{ item['name'] }}</h2>
|
||||
@ -13,10 +15,19 @@
|
||||
<p class="level-item"><a href="{{ base['url_to']('contribute.html') }}">Edit</a></p>
|
||||
</div>
|
||||
</nav>
|
||||
{% for field in item['fields'] %}{% set comma = joiner(", ") %}
|
||||
{{ macros.listing_field_title(field['title']) }}{% for entry in field['entries'] %}{{ comma() }}{{ macros.url(entry['href'], entry['name']) }}{% endfor %}<br>
|
||||
{# iterate over fields -#}
|
||||
{% for field in item['fields'] %}
|
||||
{% if field['type'] == 'text' %}
|
||||
{{ macros.render_text(field) }}
|
||||
{% elif field['type'] == 'enumeration' %}
|
||||
{{ macros.render_enumeration(field) }}
|
||||
{% elif field['type'] == 'linebreak' %}
|
||||
{% else %}
|
||||
{{ raise('Unknown field type.') }}
|
||||
{% endif %}
|
||||
<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<a class="is-light is-size-7" href="#">Back to top</a>
|
||||
</div>
|
||||
|
@ -1,13 +1,31 @@
|
||||
{% macro url(href, name) -%}
|
||||
{% if href %}
|
||||
<a href="{{ base['url_to'](href) }}">{{ name }}</a>
|
||||
{% else %}
|
||||
{{ name }}
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
||||
{# A single line of text with a line break at the end and optionally a format class. (see https://bulma.io/documentation/helpers/typography-helpers/) #}
|
||||
{%- macro render_text(text) -%}
|
||||
{%- if 'class' in text -%} {# Enhanced text #}
|
||||
<span class="{{ text['class'] }}">{{ text['text'] }}</span>
|
||||
{%- else -%}
|
||||
{{ text['text'] }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# Some text surrounded by a link tag #}
|
||||
{%- macro render_url(url) -%}
|
||||
<a href="{{ base['url_to'](url['href']) }}">{{ render_text(url['text']) }}</a>
|
||||
{%- endmacro -%}
|
||||
|
||||
{# Renders either plain text or a link depending on the type #}
|
||||
{%- macro render_enumeration_entry(entry) -%}
|
||||
{%- if entry['type'] == 'text' -%}
|
||||
{{ render_text(entry) }}
|
||||
{%- elif entry['type'] == 'url' -%}
|
||||
{{ render_url(entry) }}
|
||||
{%- else -%}
|
||||
{{ raise('Unknown entry type.') }}
|
||||
{%- endif -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{# Renders a list of enumeration entries (either links or text) #}
|
||||
{%- macro render_enumeration(enumeration) -%}
|
||||
{%- set comma = joiner(", ") -%}
|
||||
{{ render_text(enumeration['name']) }}: {% for entry in enumeration['entries'] -%}{{ comma() }}{{ render_enumeration_entry(entry) }}{%- endfor -%}
|
||||
{%- endmacro -%}
|
||||
|
||||
{% macro listing_field_title(title) -%}
|
||||
{% if title %}
|
||||
{{ title['name'] }}:
|
||||
{% endif %}
|
||||
{%- endmacro %}
|
Reference in New Issue
Block a user