Skip to content

Commit

Permalink
Merge branch 'master' into yaml-playground
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Alsina committed Jun 23, 2017
2 parents 84bce32 + f9f3c54 commit 7e81266
Show file tree
Hide file tree
Showing 71 changed files with 463 additions and 272 deletions.
12 changes: 11 additions & 1 deletion CHANGES.txt
Expand Up @@ -5,20 +5,30 @@ Features
--------

* Use ``PRETTY_URLS`` by default on all sites (Issue #1838)
* Feed link generation is completely refactored (Issue #2844)

Bugfixes
--------

* Fix crash when compiling empty ``.html`` posts (Issue #2851)
* Make failures to get source commit hash non-fatal in
``github_deploy`` (Issue #2847)
* Less cryptic error when guessing format from extension in ``new_post``
fails
* Use Jupyter name more consistently in docs
* Support CODE_COLOR_SCHEME in Jupyter notebooks (Issue #2093)

* Language was not passed to title and link generation for page indexes

Removed features
----------------

* Drop Python 2 support
* Remove ``nikola install_theme`` — use ``nikola theme`` instead
* Drop insecure post encryption feature
* Stop supporting all deprecated config options
* Drop annotations support (annotateit.org closed down in March 2017)
* Remove taxonomy option ``also_create_classifications_from_other_languages``
(Issue #2785)

New in v7.8.8
=============
Expand Down
1 change: 0 additions & 1 deletion docs/sphinx/requirements-docs.txt
@@ -1,3 +1,2 @@
-r ../../requirements-extras.txt
doit
pyparsing>=2.0.2
12 changes: 9 additions & 3 deletions nikola/data/themes/base-jinja/templates/archiveindex.tmpl
Expand Up @@ -5,10 +5,16 @@

{% block extra_head %}
{{ super() }}
{{ feeds_translations.head(archive_name) }}
{{ feeds_translations.head(archive_name, kind, rss_override=False) }}
{% endblock %}

{% block content_header %}
{{ archive_nav.archive_navigation() }}
{{ parent.content_header() }}
<header>
<h1>{{ title|e }}</h1>
{{ archive_nav.archive_navigation() }}
<div class="metadata">
{{ feeds_translations.feed_link(archive, kind) }}
{{ feeds_translations.translation_link(kind) }}
</div>
</header>
{% endblock %}
6 changes: 2 additions & 4 deletions nikola/data/themes/base-jinja/templates/author.tmpl
Expand Up @@ -3,11 +3,9 @@
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block extra_head %}
{{ super() }}
{{ feeds_translations.head(author) }}
{{ feeds_translations.head(author, kind, rss_override=False) }}
{% endblock %}


{% block content %}
<article class="authorpage">
<header>
Expand All @@ -16,7 +14,7 @@
<p>{{ description }}</p>
{% endif %}
<div class="metadata">
{{ feeds_translations.feed_link(author) }}
{{ feeds_translations.feed_link(author, kind) }}
</div>
</header>
{% if posts %}
Expand Down
15 changes: 14 additions & 1 deletion nikola/data/themes/base-jinja/templates/authorindex.tmpl
Expand Up @@ -2,7 +2,20 @@
{% extends 'index.tmpl' %}
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block content_header %}
<header>
<h1>{{ title|e }}</h1>
{% if description %}
<p>{{ description }}</p>
{% endif %}
<div class="metadata">
{{ feeds_translations.feed_link(author, kind) }}
{{ feeds_translations.translation_link(kind) }}
</div>
</header>
{% endblock %}

{% block extra_head %}
{{ super() }}
{{ feeds_translations.head(author) }}
{{ feeds_translations.head(author, kind, rss_override=False) }}
{% endblock %}
8 changes: 8 additions & 0 deletions nikola/data/themes/base-jinja/templates/authors.tmpl
@@ -1,10 +1,18 @@
{# -*- coding: utf-8 -*- #}
{% extends 'base.tmpl' %}
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block extra_head %}
{{ feeds_translations.head(kind=kind, feeds=False) }}
{% endblock %}

{% block content %}
<article class="authorindex">
{% if items %}
<h2>{{ messages("Authors") }}</h2>
<div class="metadata">
{{ feeds_translations.translation_link(kind) }}
</div>
<ul class="postlist">
{% for text, link in items %}
{% if text not in hidden_authors %}
Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/base-jinja/templates/base_helper.tmpl
Expand Up @@ -42,7 +42,7 @@ lang="{{ lang }}">
{% if meta_generator_tag %}
<meta name="generator" content="Nikola (getnikola.com)">
{% endif %}
{{ feeds_translations.head() }}
{{ feeds_translations.head(classification=None, kind='index', other=False) }}
<link rel="canonical" href="{{ abs_link(permalink) }}">

{% if favicons %}
Expand Down Expand Up @@ -101,7 +101,7 @@ lang="{{ lang }}">

{# This function is deprecated; use feed_helper directly. #}
{% macro html_feedlinks() %}
{{ feeds_translations.head() }}
{{ feeds_translations.head(classification=None, kind='index', other=False) }}
{% endmacro %}

{% macro html_translations() %}
Expand Down
153 changes: 93 additions & 60 deletions nikola/data/themes/base-jinja/templates/feeds_translations_helper.tmpl
@@ -1,90 +1,123 @@
{# -*- coding: utf-8 -*- #}

{# Handles both feeds and translations #}
{% macro head(classification=None) %}
{% if rss_link %}
{{ rss_link }}
{% macro _head_feed_link(link_type, link_name, link_postfix, classification, kind, language) %}
{% if translations|length > 1 %}
<link rel="alternate" type="{{ link_type }}" title="{{ link_name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + '_' + link_postfix, classification, language) }}">
{% else %}
<link rel="alternate" type="{{ link_type }}" title="{{ link_name|e }}" hreflang="{{ language }}" href="{{ _link(kind + '_' + link_postfix, classification, language) }}">
{% endif %}
{% endmacro %}

{% macro _html_feed_link(link_type, link_name, link_postfix, classification, kind, language, name=None) %}
{% if translations|length > 1 %}
{% for language in translations|sort %}
{% if classification %}
{% if generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_atom", classification, language) }}">
{% endif %}
{% if generate_rss and not rss_link %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }} ({{ language }})" href="{{ _link(kind + "_rss", classification, language) }}">
{% endif %}
{% else %}
{% if generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom ({{ language }})" href="{{ _link("index_atom", None, language) }}">
{% endif %}
{% if generate_rss and not rss_link %}
<link rel="alternate" type="application/rss+xml" title="RSS ({{ language }})" href="{{ _link("rss", None, language) }}">
{% endif %}
{% endif %}
{% endfor %}
{% if name and kind != "archive" and kind != "author" %}
<a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ name|e }}, {{ language }})</a>
{% else %}
<a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ language }})</a>
{% endif %}
{% else %}
{% if classification %}
{% if generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_atom", classification) }}">
{% endif %}
{% if generate_rss and not rss_link %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ classification|e }}" href="{{ _link(kind + "_rss", classification) }}">
{% endif %}
{% if name and kind != "archive" and kind != "author" %}
<a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }} ({{ name|e }})</a>
{% else %}
{% if generate_atom %}
<link rel="alternate" type="application/atom+xml" title="Atom" href="{{ _link("index_atom", None) }}">
{% endif %}
{% if generate_rss and not rss_link %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ _link("rss", None) }}">
{% endif %}
<a href="{{ _link(kind + '_' + link_postfix, classification, language) }}" hreflang="{{ language }}" type="{{ link_type }}">{{ messages(link_name, language) }}</a>
{% endif %}
{% endif %}
{% if has_other_languages and other_languages %}
{% endmacro %}

{% macro _html_translation_link(classification, kind, language, name=None) %}
{% if name and kind != "archive" and kind != "author" %}
<a href="{{ _link(kind, classification, language) }}" hreflang="{{ language }}" rel="alternate">{{ messages("LANGUAGE", language) }} ({{ name|e }})</a>
{% else %}
<a href="{{ _link(kind, classification, language) }}" hreflang="{{ language }}" rel="alternate">{{ messages("LANGUAGE", language) }}</a>
{% endif %}
{% endmacro %}

{% macro _head_rss(classification=None, kind='index', rss_override=True) %}
{% if rss_link and rss_override %}
{{ rss_link }}
{% endif %}
{% if generate_rss and not (rss_link and rss_override) and kind != 'archive' %}
{% if translations|length > 1 and has_other_languages and classification and kind != 'index' %}
{% for language, classification, name in all_languages %}
<link rel="alternate" type="application/rss+xml" title="RSS for {{ kind }} {{ name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + "_rss", classification, language) }}">
{% endfor %}
{% else %}
{% for language in translations|sort %}
{% if (classification or classification == '') and kind != 'index' %}
{{ _head_feed_link('application/rss+xml', 'RSS for ' + kind + ' ' + classification, 'rss', classification, kind, language) }}
{% else %}
{{ _head_feed_link('application/rss+xml', 'RSS', 'rss', classification, 'index', language) }}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endmacro %}

{% macro _head_atom(classification=None, kind='index') %}
{% if generate_atom %}
{% if translations|length > 1 and has_other_languages and classification and kind != 'index' %}
{% for language, classification, name in all_languages %}
<link rel="alternate" type="application/atom+xml" title="Atom for {{ kind }} {{ name|e }} ({{ language }})" hreflang="{{ language }}" href="{{ _link(kind + "_atom", classification, language) }}">
{% endfor %}
{% else %}
{% for language in translations|sort %}
{% if (classification or classification == '') and kind != 'index' %}
{{ _head_feed_link('application/atom+xml', 'Atom for ' + kind + ' ' + classification, 'atom', classification, kind, language) }}
{% else %}
{{ _head_feed_link('application/atom+xml', 'Atom', 'atom', classification, 'index', language) }}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endmacro %}

{# Handles both feeds and translations #}
{% macro head(classification=None, kind='index', feeds=True, other=True, rss_override=True, has_no_feeds=False) %}
{% if feeds and not has_no_feeds %}
{{ _head_rss(classification, 'index' if (kind == 'archive' and rss_override) else kind, rss_override) }}
{{ _head_atom(classification, kind) }}
{% endif %}
{% if other and has_other_languages and other_languages %}
{% for language, classification, _ in other_languages %}
<link rel="alternate" hreflang="{{ language }}" href="{{ _link(kind, classification, language) }}">
{% endfor %}
{% endif %}
{% endmacro %}

{% macro feed_link(classification) %}
{% if translations|length > 1 %}
{% for language in translations|sort %}
{% if generate_atom or generate_rss %}
{% macro feed_link(classification, kind) %}
{% if generate_atom or generate_rss %}
{% if translations|length > 1 and has_other_languages and kind != 'index' %}
{% for language, classification, name in all_languages %}
<p class="feedlink">
{% if generate_atom %}
<a href="{{ _link(kind + "_atom", classification, language) }}" hreflang="{{ language }}" type="application/atom+xml">{{ messages('Atom feed', language) }} ({{ language }})</a>
{{ _html_feed_link('application/atom+xml', 'Atom feed', 'atom', classification, kind, language, name) }}
{% endif %}
{% if generate_rss %}
<a href="{{ _link(kind + "_rss", classification, language) }}" hreflang="{{ language }}" type="application/rss+xml">{{ messages('RSS feed', language) }} ({{ language }})</a>
{% if generate_rss and kind != 'archive' %}
{{ _html_feed_link('application/rss+xml', 'RSS feed', 'rss', classification, kind, language, name) }}
{% endif %}
</p>
{% endif %}
{% endfor %}
{% else %}
{% if generate_atom or generate_rss %}
<p class="feedlink">
{% if generate_atom %}
<a href="{{ _link(kind + "_atom", classification) }}" type="application/atom+xml">{{ messages('Atom feed') }}</a>
{% endif %}
{% if generate_rss %}
<a href="{{ _link(kind + "_rss", classification) }}" type="application/rss+xml">{{ messages('RSS feed') }}</a>
{% endif %}
</p>
{% endfor %}
{% else %}
{% for language in translations|sort %}
<p class="feedlink">
{% if generate_atom %}
{{ _html_feed_link('application/atom+xml', 'Atom feed', 'atom', classification, kind, language) }}
{% endif %}
{% if generate_rss and kind != 'archive' %}
{{ _html_feed_link('application/rss+xml', 'RSS feed', 'rss', classification, kind, language) }}
{% endif %}
</p>
{% endfor %}
{% endif %}
{% endif %}
{% endmacro %}

{% macro translation_link() %}
{% macro translation_link(kind) %}
{% 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>
<p>{{ _html_translation_link(classification, kind, language, name) }}</p>
{% endfor %}
</div>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/index.tmpl
Expand Up @@ -16,7 +16,7 @@

{% block content %}
{% block content_header %}
{{ feeds_translations.translation_link() }}
{{ feeds_translations.translation_link(kind) }}
{% endblock %}
{% if 'main_index' in pagekind %}
{{ front_index_header }}
Expand Down
6 changes: 5 additions & 1 deletion nikola/data/themes/base-jinja/templates/list.tmpl
Expand Up @@ -3,13 +3,17 @@
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block extra_head %}
{{ feeds_translations.head(kind=kind, rss_override=False, has_no_feeds=has_no_feeds) }}
{% endblock %}

{% block content %}
<article class="listpage">
<header>
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{{ feeds_translations.translation_link() }}
{{ feeds_translations.translation_link(kind) }}
{% if items %}
<ul class="postlist">
{% for text, link, count in items %}
Expand Down
6 changes: 5 additions & 1 deletion nikola/data/themes/base-jinja/templates/list_post.tmpl
Expand Up @@ -3,13 +3,17 @@
{% import 'archive_navigation_helper.tmpl' as archive_nav with context %}
{% import 'feeds_translations_helper.tmpl' as feeds_translations with context %}

{% block extra_head %}
{{ feeds_translations.head(kind=kind, rss_override=False) }}
{% endblock %}

{% block content %}
<article class="listpage">
<header>
<h1>{{ title|e }}</h1>
</header>
{{ archive_nav.archive_navigation() }}
{{ feeds_translations.translation_link() }}
{{ feeds_translations.translation_link(kind) }}
{% if posts %}
<ul class="postlist">
{% for post in posts %}
Expand Down
7 changes: 5 additions & 2 deletions nikola/data/themes/base-jinja/templates/sectionindex.tmpl
Expand Up @@ -4,14 +4,17 @@

{% block extra_head %}
{{ super() }}
{{ feeds_translations.head(section) }}
{{ feeds_translations.head(section, kind, rss_override=False) }}
{% endblock %}

{% block content %}
<div class="sectionindex">
<header>
<h2><a href="{{ _link('section_index', section) }}">{{ title|e }}</a></h2>
{{ feeds_translations.feed_link(section) }}
<div class="metadata">
{{ feeds_translations.feed_link(section, kind) }}
{{ feeds_translations.translation_link(kind) }}
</div>
</header>
{{ super() }}
</div>
Expand Down

0 comments on commit 7e81266

Please sign in to comment.