Skip to content

Commit

Permalink
[autofix] Format Jinja
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeldycke committed Mar 10, 2023
1 parent f74f555 commit bcb6c2e
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 92 deletions.
145 changes: 71 additions & 74 deletions plumage/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,85 +13,82 @@ <h1>
</h1>
{% endblock %}
{% block right_sidebar %}

<ul class="list-group list-group-flush list-group-item-dark small fw-light">
<ul class="list-group list-group-flush list-group-item-dark small fw-light">
<li class="list-group-item bg-transparent">
<abbr title="{{ article.date.isoformat() }}"><i class="fas fa-calendar"></i> {{ article.locale_date }}</abbr>
</li>
{% if AUTHOR_SAVE_AS and article.authors %}
<li class="list-group-item bg-transparent">
<abbr title="{{ article.date.isoformat() }}"><i class="fas fa-calendar"></i> {{ article.locale_date }}</abbr>
<address>
<i class="fas fa-user"></i> By
{% for author in article.authors %}
<a href="{{ SITEURL }}/{{ author.url }}" rel="author">{{ author.name }}</a>
{% endfor %}
</address>
</li>
{% if AUTHOR_SAVE_AS and article.authors %}
<li class="list-group-item bg-transparent">
<address>
<i class="fas fa-user"></i> By
{% for author in article.authors %}
<a href="{{ SITEURL }}/{{ author.url }}" rel="author">{{ author.name }}</a>
{% endfor %}
</address>
</li>
{% endif %}
{% if article.category or article.tags %}
<li class="list-group-item bg-transparent">
<ul class="list-inline">
{% if article.category %}
{% for category, articles in categories %}
{% if category.url == article.category.url %}
{% set article_counter = articles|length() %}
<li class="list-inline-item">
<a href="{{ SITEURL }}/{{ article.category.url }}"
rel="tag"
class="badge text-bg-info"
data-bs-toggle="tooltip"
title="{{ article_counter }} article{{ 's' if article_counter > 1 else '' }} in this category">
{{ article.category }}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% if article.tags %}
{% set article_tags = [] %}
{% for tag, articles in tags %}
{% for t in article.tags %}
{% if tag.url == t.url %}
{% if article_tags.append({'name': tag.name, 'url': tag.url, 'articles': articles|length()}) %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
{# Sort by tag frequency, then alphabetically #}
{% for tag in article_tags|sort(attribute='name')|sort(reverse=True, attribute='articles') %}
{% endif %}
{% if article.category or article.tags %}
<li class="list-group-item bg-transparent">
<ul class="list-inline">
{% if article.category %}
{% for category, articles in categories %}
{% if category.url == article.category.url %}
{% set article_counter = articles|length() %}
<li class="list-inline-item">
{{ m.render_tag(tag) }}
<a href="{{ SITEURL }}/{{ article.category.url }}"
rel="tag"
class="badge text-bg-info"
data-bs-toggle="tooltip"
title="{{ article_counter }} article{{ 's' if article_counter > 1 else '' }} in this category">
{{ article.category }}
</a>
</li>
{% endif %}
{% endfor %}
{% endif %}
{% if article.tags %}
{% set article_tags = [] %}
{% for tag, articles in tags %}
{% for t in article.tags %}
{% if tag.url == t.url %}
{% if article_tags.append({'name': tag.name, 'url': tag.url, 'articles': articles|length()}) %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</ul>
</li>
{% endif %}
{% if ARTICLE_EDIT_LINK %}
<li class="list-group-item bg-transparent text-center">
Found a typo? Fix it now:<br/>
<a class="btn btn-outline-info btn-sm border-0 d-block stretched-link"
href="{{ ARTICLE_EDIT_LINK % {'slug': article.slug} }}"><i class="fas fa-edit fa-fw"></i> Edit article on GitHub</a>
</li>
{% endif %}
{% if article.prev_article or article.next_article %}
<li class="list-group-item bg-transparent">
<nav class="nav nav-pills nav-fill">
<a class="nav-link btn btn-outline-primary border-0 {% if not article.prev_article %} disabled{% endif %}"
{% if article.prev_article %} href="{{ SITEURL }}/{{ article.prev_article.url }}" title="{{ article.prev_article.title|striptags|e }}" {% endif %}
rel="prev">
<span aria-hidden="true"></span> Older
</a>
<a class="nav-link btn btn-outline-primary border-0 {% if not article.next_article %} disabled{% endif %}"
{% if article.next_article %} href="{{ SITEURL }}/{{ article.next_article.url }}" title="{{ article.next_article.title|striptags|e }}" {% endif %}
rel="next">
Newer <span aria-hidden="true"></span>
</a>
</nav>
</li>
{% endif %}
</ul>

{% endfor %}
{# Sort by tag frequency, then alphabetically #}
{% for tag in article_tags|sort(attribute='name')|sort(reverse=True, attribute='articles') %}
<li class="list-inline-item">{{ m.render_tag(tag) }}</li>
{% endfor %}
{% endif %}
</ul>
</li>
{% endif %}
{% if ARTICLE_EDIT_LINK %}
<li class="list-group-item bg-transparent text-center">
Found a typo? Fix it now:
<br/>
<a class="btn btn-outline-info btn-sm border-0 d-block stretched-link"
href="{{ ARTICLE_EDIT_LINK % {'slug': article.slug} }}"><i class="fas fa-edit fa-fw"></i> Edit article on GitHub</a>
</li>
{% endif %}
{% if article.prev_article or article.next_article %}
<li class="list-group-item bg-transparent">
<nav class="nav nav-pills nav-fill">
<a class="nav-link btn btn-outline-primary border-0 {% if not article.prev_article %} disabled{% endif %}"
{% if article.prev_article %} href="{{ SITEURL }}/{{ article.prev_article.url }}" title="{{ article.prev_article.title|striptags|e }}" {% endif %}
rel="prev">
<span aria-hidden="true"></span> Older
</a>
<a class="nav-link btn btn-outline-primary border-0 {% if not article.next_article %} disabled{% endif %}"
{% if article.next_article %} href="{{ SITEURL }}/{{ article.next_article.url }}" title="{{ article.next_article.title|striptags|e }}" {% endif %}
rel="next">
Newer <span aria-hidden="true"></span>
</a>
</nav>
</li>
{% endif %}
</ul>
{% endblock %}
{% block content %}
{% import 'translations.html' as translations with context %}
Expand Down
12 changes: 8 additions & 4 deletions plumage/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,12 @@ <h1>
</ul>
{% if STORK_SEARCH %}
<div class="position-relative dropdown">
<input data-stork="sitesearch" class="form-control dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" />
<div data-stork="sitesearch-output" class="dropdown-menu dropdown-menu-end shadow"></div>
<input data-stork="sitesearch"
class="form-control dropdown-toggle"
data-bs-toggle="dropdown"
aria-expanded="false"/>
<div data-stork="sitesearch-output"
class="dropdown-menu dropdown-menu-end shadow"></div>
</div>
{% endif %}
</div>
Expand All @@ -187,8 +191,8 @@ <h1>
</div>
{% endif %}
<main id="content"
role="main"
class=" {% if LAYOUT == 'full-width' %} offset-md-1 {% elif has_left_content and has_right_content %} col-md-6 {% elif has_left_content or has_right_content %} col-md-9 {% else %} col-md-12 {% endif %}">
role="main"
class=" {% if LAYOUT == 'full-width' %} offset-md-1 {% elif has_left_content and has_right_content %} col-md-6 {% elif has_left_content or has_right_content %} col-md-9 {% else %} col-md-12 {% endif %}">
{% block content %}{% endblock %}
</main>
{% if LAYOUT != 'full-width' and has_right_content %}
Expand Down
14 changes: 4 additions & 10 deletions plumage/templates/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
%}
{% macro render_card(all_tags, project) %}
<div class="card">
{% if project.inactive %}
<div class="corner-banner shadow-sm bg-danger text-white fw-bold">Inactive</div>
{% endif %}
{% if project.inactive %}<div class="corner-banner shadow-sm bg-danger text-white fw-bold">Inactive</div>{% endif %}
{% if project.thumb %}
{% if project.thumb_link %}<a href="{{ project.thumb_link }}">{% endif %}
<img class="card-img-top"
Expand All @@ -46,9 +44,7 @@ <h4 class="card-title">{{ project.name }}</h4>
{% endfor %}
{# Sort by tag frequency, then alphabetically #}
{% for tag in all_tags|sort(attribute='name')|sort(reverse=True, attribute='articles') %}
{% if tag.name in project.tools %}
<li class="list-inline-item">{{ m.render_tag(tag) }}</li>
{% endif %}
{% if tag.name in project.tools %}<li class="list-inline-item">{{ m.render_tag(tag) }}</li>{% endif %}
{% endfor %}
{% set tag_names = [] %}
{% for tag in all_tags %}
Expand Down Expand Up @@ -111,9 +107,7 @@ <h4 class="card-title">{{ project.name }}</h4>
{% endfor %}
{% for project_list in [active_projects, inactive_projects] %}
{% for project in project_list %}
<div class="col-sm-6 col-lg-4 mb-4">
{{ render_card(all_tags, project) }}
</div>
<div class="col-sm-6 col-lg-4 mb-4">{{ render_card(all_tags, project) }}</div>
{% endfor %}
{% endfor %}
{% block project_post_content %}{% endblock %}
Expand All @@ -140,4 +134,4 @@ <h4 class="card-title">{{ project.name }}</h4>
{% else %}
{{ render_projects(PROJECTS) }}
{% endif %}
{% endblock %}
{% endblock %}
6 changes: 2 additions & 4 deletions plumage/templates/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ <h1>
{% for (tier_name, tier_tags) in [("Top", tier_1), ("Middle", tier_2), ("Lower", tier_3)] %}
<h2>{{ tier_name }} tier</h2>
<ul class="list-inline">
{% for tag in tier_tags %}
<li class="list-inline-item">{{ m.render_tag(tag) }}</li>
{% endfor %}
{% for tag in tier_tags %}<li class="list-inline-item">{{ m.render_tag(tag) }}</li>{% endfor %}
</ul>
{% endfor %}
{% endblock %}
{% endblock %}

0 comments on commit bcb6c2e

Please sign in to comment.