Skip to content
Permalink
Browse files
Code deduplication.
  • Loading branch information
felixfontein committed Jun 8, 2017
1 parent f2ad9b3 commit 4b6f57ade48b474443a7ccc4cdf7c5df1c689550
Showing 10 changed files with 44 additions and 96 deletions.
@@ -3,6 +3,7 @@
{% import 'math_helper.tmpl' as math with context %}
{% import 'comments_helper.tmpl' as comments with context %}
{% import 'pagination_helper.tmpl' as pagination with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}
{% extends 'base.tmpl' %}

{% block extra_head %}
@@ -15,18 +16,7 @@

{% block content %}
{% block content_header %}
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
{{ translation_links.translation_link() }}
{% endblock %}
{% if 'main_index' in pagekind %}
{{ front_index_header }}
@@ -1,25 +1,15 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block content %}
<article class="listpage">
<header>
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
{{ translation_links.translation_link() }}
{% if items %}
<ul class="postlist">
{% for text, link, count in items %}
@@ -1,25 +1,15 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}
{% import 'translation_link_helper.tmpl' as translation_links with context %}

{% block content %}
<article class="listpage">
<header>
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
{{ translation_links.translation_link() }}
{% if posts %}
<ul class="postlist">
{% for post in posts %}
@@ -26,18 +26,7 @@
<div class="metadata">
{{ translation_links.link(tag) }}
</div>
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
{{ translation_links.translation_link() }}
</header>
{% if posts %}
<ul class="postlist">
@@ -72,3 +72,18 @@
{% endif %}
{% endif %}
{% endmacro %}

{% macro translation_link() %}
{% if has_other_languages and other_languages %}
<div class="translationslist translations">
<h3 class="translationslist-intro">{{ messages("Also available in:") }}</h3>
{% for language, classification, name in other_languages %}
<p><a href="{{ _link(kind, classification, language) }}" rel="alternate">{{ messages("LANGUAGE", language) }}
{% if kind != 'archive' %}
({{ name|e }})
{% endif %}
</a></p>
{% endfor %}
</div>
{% endif %}
{% endmacro %}
@@ -3,6 +3,7 @@
<%namespace name="math" file="math_helper.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="pagination" file="pagination_helper.tmpl"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>
<%inherit file="base.tmpl"/>

<%block name="extra_head">
@@ -15,18 +16,7 @@

<%block name="content">
<%block name="content_header">
%if has_other_languages and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
%if kind != 'archive':
(${name|h})
%endif
</a></p>
%endfor
</div>
%endif
${translation_links.translation_link()}
</%block>
% if 'main_index' in pagekind:
${front_index_header}
@@ -1,25 +1,15 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="content">
<article class="listpage">
<header>
<h1>${title|h}</h1>
</header>
${archive_nav.archive_navigation()}
%if has_other_languages and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
%if kind != 'archive':
(${name|h})
%endif
</a></p>
%endfor
</div>
%endif
${translation_links.translation_link()}
%if items:
<ul class="postlist">
% for text, link, count in items:
@@ -1,25 +1,15 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%namespace name="archive_nav" file="archive_navigation_helper.tmpl" import="*"/>
<%namespace name="translation_links" file="translation_link_helper.tmpl" import="*"/>

<%block name="content">
<article class="listpage">
<header>
<h1>${title|h}</h1>
</header>
${archive_nav.archive_navigation()}
%if has_other_languages and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
%if kind != 'archive':
(${name|h})
%endif
</a></p>
%endfor
</div>
%endif
${translation_links.translation_link()}
%if posts:
<ul class="postlist">
% for post in posts:
@@ -26,18 +26,7 @@
<div class="metadata">
${translation_links.link(tag)}
</div>
%if has_other_languages and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
%if kind != 'archive':
(${name|h})
%endif
</a></p>
%endfor
</div>
%endif
${translation_links.translation_link()}
</header>
%if posts:
<ul class="postlist">
@@ -72,3 +72,18 @@
% endif
% endif
</%def>

<%def name="translation_link()">
%if has_other_languages and other_languages:
<div class="translationslist translations">
<h3 class="translationslist-intro">${messages("Also available in:")}</h3>
%for language, classification, name in other_languages:
<p><a href="${_link(kind, classification, language)}" rel="alternate">${messages("LANGUAGE", language)}
%if kind != 'archive':
(${name|h})
%endif
</a></p>
%endfor
</div>
%endif
</%def>

0 comments on commit 4b6f57a

Please sign in to comment.