From 9b7f4aee26134277730fd3a35a7a20f2c7ba8f65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 7 Jul 2019 21:34:50 +0200 Subject: [PATCH] Trim extra trailing newlines before passing it to Jinja's indent(). In Jinja 2.9 indent() unconditionally stripped the trailing newline, in 2.10 it preserves it. That ... actually makes sense, so we have to adapt. --- documentation/templates/doxygen/annotated.html | 2 +- .../templates/doxygen/base-class-reference.html | 2 +- documentation/templates/doxygen/base-reference.html | 2 +- documentation/templates/doxygen/base.html | 4 ++-- documentation/templates/doxygen/files.html | 2 +- documentation/templates/doxygen/modules.html | 2 +- documentation/templates/doxygen/namespaces.html | 2 +- documentation/templates/doxygen/page.html | 2 +- documentation/templates/doxygen/pages.html | 2 +- documentation/templates/python/base.html | 6 +++--- documentation/templates/python/classes.html | 2 +- documentation/templates/python/modules.html | 2 +- documentation/templates/python/pages.html | 2 +- pelican-theme/templates/archives.html | 6 +++--- pelican-theme/templates/article.html | 12 ++++++------ pelican-theme/templates/article_badges.html | 4 ++-- pelican-theme/templates/author.html | 2 +- pelican-theme/templates/base.html | 2 +- pelican-theme/templates/base_blog_section.html | 6 +++--- pelican-theme/templates/category.html | 2 +- pelican-theme/templates/page.html | 2 +- pelican-theme/templates/passthrough.html | 2 +- pelican-theme/templates/tag.html | 2 +- 23 files changed, 36 insertions(+), 36 deletions(-) diff --git a/documentation/templates/doxygen/annotated.html b/documentation/templates/doxygen/annotated.html index f86a7667..a81e2031 100644 --- a/documentation/templates/doxygen/annotated.html +++ b/documentation/templates/doxygen/annotated.html @@ -9,7 +9,7 @@
  • {{ i.kind }} {{ i.name }}{% if i.is_deprecated %} deprecated{% endif %} {{ i.brief }}
  • {% else %} diff --git a/documentation/templates/doxygen/base-class-reference.html b/documentation/templates/doxygen/base-class-reference.html index d20b3d47..abcb996c 100644 --- a/documentation/templates/doxygen/base-class-reference.html +++ b/documentation/templates/doxygen/base-class-reference.html @@ -58,7 +58,7 @@
  • {{ name }}
  • {% else %} diff --git a/documentation/templates/doxygen/base-reference.html b/documentation/templates/doxygen/base-reference.html index 82e0f145..0613dde4 100644 --- a/documentation/templates/doxygen/base-reference.html +++ b/documentation/templates/doxygen/base-reference.html @@ -34,7 +34,7 @@
  • {{ name }}
  • {% else %} diff --git a/documentation/templates/doxygen/base.html b/documentation/templates/doxygen/base.html index d98bc83d..e06ff8a5 100644 --- a/documentation/templates/doxygen/base.html +++ b/documentation/templates/doxygen/base.html @@ -19,7 +19,7 @@ {% endif %} {% if M_HTML_HEADER %} - {{ M_HTML_HEADER|indent(2) }} + {{ M_HTML_HEADER|rtrim|indent(2) }} {% endif %} @@ -128,7 +128,7 @@
    - {{ M_SEARCH_HELP|indent(12) }} + {{ M_SEARCH_HELP|rtrim|indent(12) }}
    Sorry, nothing was found.{% if M_SEARCH_EXTERNAL_URL %}
    Maybe try a full-text search with external engine?{% endif %}
    diff --git a/documentation/templates/doxygen/files.html b/documentation/templates/doxygen/files.html index c2331cea..972ca7d0 100644 --- a/documentation/templates/doxygen/files.html +++ b/documentation/templates/doxygen/files.html @@ -9,7 +9,7 @@
  • {{ i.kind }} {{ i.name }}{% if i.is_deprecated %} deprecated{% endif %} {{ i.brief }}
  • {% else %} diff --git a/documentation/templates/doxygen/modules.html b/documentation/templates/doxygen/modules.html index b59d47c1..8487a1bd 100644 --- a/documentation/templates/doxygen/modules.html +++ b/documentation/templates/doxygen/modules.html @@ -9,7 +9,7 @@
  • module {{ i.name }}{% if i.is_deprecated %} deprecated{% endif %} {{ i.brief }}
  • {% else %} diff --git a/documentation/templates/doxygen/namespaces.html b/documentation/templates/doxygen/namespaces.html index eb8d1cff..986ab38c 100644 --- a/documentation/templates/doxygen/namespaces.html +++ b/documentation/templates/doxygen/namespaces.html @@ -9,7 +9,7 @@
  • {{ i.kind }} {{ i.name }}{% if i.is_deprecated %} deprecated{% endif %} {{ i.brief }}
  • {% else %} diff --git a/documentation/templates/doxygen/page.html b/documentation/templates/doxygen/page.html index 82d8087b..473d30f3 100644 --- a/documentation/templates/doxygen/page.html +++ b/documentation/templates/doxygen/page.html @@ -30,7 +30,7 @@
  • {{ name }}
  • {% else %} diff --git a/documentation/templates/doxygen/pages.html b/documentation/templates/doxygen/pages.html index ac812fb9..8d52dd8a 100644 --- a/documentation/templates/doxygen/pages.html +++ b/documentation/templates/doxygen/pages.html @@ -9,7 +9,7 @@
  • {{ i.name }}{% if i.is_deprecated %} deprecated{% endif %} {{ i.brief }}
  • {% else %} diff --git a/documentation/templates/python/base.html b/documentation/templates/python/base.html index 6c61189f..aaa3197f 100644 --- a/documentation/templates/python/base.html +++ b/documentation/templates/python/base.html @@ -19,7 +19,7 @@ {% endif %} {% if HTML_HEADER %} - {{ HTML_HEADER|indent(2) }} + {{ HTML_HEADER|rtrim|indent(2) }} {% endif %} @@ -120,7 +120,7 @@
    - {{ SEARCH_HELP|render_rst|indent(12) }} + {{ SEARCH_HELP|render_rst|rtrim|indent(12) }}
    Sorry, nothing was found.{% if SEARCH_EXTERNAL_URL %}
    Maybe try a full-text search with external engine?{% endif %}
    @@ -146,7 +146,7 @@ {% if FINE_PRINT == '[default]' %}

    {{ PROJECT_TITLE }}{% if PROJECT_SUBTITLE %} {{ PROJECT_SUBTITLE }}{% endif %}. Created with m.css Python doc generator.

    {% else %} - {{ FINE_PRINT|render_rst|indent(8) }} + {{ FINE_PRINT|render_rst|rtrim|indent(8) }} {% endif %} diff --git a/documentation/templates/python/classes.html b/documentation/templates/python/classes.html index 2f9404dd..8b0b3bdb 100644 --- a/documentation/templates/python/classes.html +++ b/documentation/templates/python/classes.html @@ -9,7 +9,7 @@
  • {{ i.kind }} {{ i.name }} {{ i.summary }}
  • {% else %} diff --git a/documentation/templates/python/modules.html b/documentation/templates/python/modules.html index 8264d2fc..cd954c9b 100644 --- a/documentation/templates/python/modules.html +++ b/documentation/templates/python/modules.html @@ -9,7 +9,7 @@
  • {{ i.kind }} {{ i.name }} {{ i.summary }}
  • {% else %} diff --git a/documentation/templates/python/pages.html b/documentation/templates/python/pages.html index 25c40990..629d7160 100644 --- a/documentation/templates/python/pages.html +++ b/documentation/templates/python/pages.html @@ -9,7 +9,7 @@
  • {{ i.name }} {{ i.summary }}
  • {% else %} diff --git a/pelican-theme/templates/archives.html b/pelican-theme/templates/archives.html index 2332d95c..7ccd07d0 100644 --- a/pelican-theme/templates/archives.html +++ b/pelican-theme/templates/archives.html @@ -54,7 +54,7 @@ {% for article in article_list %}
    {% macro header() %}{% include "article_header.html" %}{% endmacro %} - {{ header()|indent(8) }} + {{ header()|rtrim|indent(8) }} {% set show_content = article.content and loop.first and (not articles_page or articles_page.number == 1) and ((article.collapse_first is defined and article.collapse_first != 'True') or @@ -67,7 +67,7 @@ {% endif %}
    {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} - {{ footer()|indent(10) }} + {{ footer()|rtrim|indent(10) }}
    {% if not show_content %}
    @@ -76,7 +76,7 @@ {% endfor %} {% if articles_page and articles_page.has_other_pages() %} {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %} - {{ pagination()|indent(6) }} + {{ pagination()|rtrim|indent(6) }} {% endif %} {% endblock %} diff --git a/pelican-theme/templates/article.html b/pelican-theme/templates/article.html index 266e132c..7b09f18b 100644 --- a/pelican-theme/templates/article.html +++ b/pelican-theme/templates/article.html @@ -96,7 +96,7 @@ {{ article.content|trim }} {% if article.category.badge or (article.author and article.author.badge) %} - {{ badges()|indent(10) }} + {{ badges()|rtrim|indent(10) }} {% endif %} @@ -106,7 +106,7 @@
    {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} - {{ footer()|indent(10) }} + {{ footer()|rtrim|indent(10) }}
    @@ -114,10 +114,10 @@ {% else %}
    {% macro header() %}{% include "article_header.html" %}{% endmacro %} - {{ header()|indent(6) }} + {{ header()|rtrim|indent(6) }}
    {% if article.archived == 'True' and M_ARCHIVED_ARTICLE_BADGE %} - {{ M_ARCHIVED_ARTICLE_BADGE|render_rst|replace('{year}', article.date.year)|indent(6) }} + {{ M_ARCHIVED_ARTICLE_BADGE|render_rst|replace('{year}', article.date.year)|rtrim|indent(6) }} {% endif %} {% if article.content %} @@ -125,11 +125,11 @@ {% endif %} {% if article.category.badge or (article.author and article.author.badge) %} - {{ badges()|indent(6) }} + {{ badges()|rtrim|indent(6) }} {% endif %}
    {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} - {{ footer()|indent(8) }} + {{ footer()|rtrim|indent(8) }}
    {% endif %} diff --git a/pelican-theme/templates/article_badges.html b/pelican-theme/templates/article_badges.html index e62c9d0f..95f129c9 100644 --- a/pelican-theme/templates/article_badges.html +++ b/pelican-theme/templates/article_badges.html @@ -4,7 +4,7 @@ {{ article.author|e }} {% endif %}

    About the author

    - {{ article.author.badge|expand_links(article)|indent(2) }} + {{ article.author.badge|expand_links(article)|rtrim|indent(2) }} {% endif %} {% if article.category.badge %} @@ -13,6 +13,6 @@ {{ article.category|e }} {% endif %}

    {% if article.category.badge_title %}{{ article.category.badge_title }}{% else %}{{ article.category|e }}{% endif %}

    - {{ article.category.badge|expand_links(article)|indent(2) }} + {{ article.category.badge|expand_links(article)|rtrim|indent(2) }} {% endif %} diff --git a/pelican-theme/templates/author.html b/pelican-theme/templates/author.html index c919d7f5..917b1f87 100644 --- a/pelican-theme/templates/author.html +++ b/pelican-theme/templates/author.html @@ -41,7 +41,7 @@ {{ author|e }} {% endif %}

    {% if author.page.title %}{{ author.page.title }}{% else %}{{ author|e }}{% endif %}

    - {{ author.page.content|indent(8) }} + {{ author.page.content|rtrim|indent(8) }} {% endif %} {% endblock %} diff --git a/pelican-theme/templates/base.html b/pelican-theme/templates/base.html index 9c6d1e67..71442dfb 100644 --- a/pelican-theme/templates/base.html +++ b/pelican-theme/templates/base.html @@ -171,7 +171,7 @@ {% if not M_FINE_PRINT is defined or M_FINE_PRINT %}
    - {{ (M_FINE_PRINT or SITENAME + ". Powered by `Pelican `_ and `m.css `_.")|render_rst|indent(8) }} + {{ (M_FINE_PRINT or SITENAME + ". Powered by `Pelican `_ and `m.css `_.")|render_rst|rtrim|indent(8) }}
    {% endif %} diff --git a/pelican-theme/templates/base_blog_section.html b/pelican-theme/templates/base_blog_section.html index 5d10e120..327ad150 100644 --- a/pelican-theme/templates/base_blog_section.html +++ b/pelican-theme/templates/base_blog_section.html @@ -25,17 +25,17 @@ {% for article in articles_page.object_list %}
    {% macro header() %}{% include "article_header.html" %}{% endmacro %} - {{ header()|indent(8) }} + {{ header()|rtrim|indent(8) }}
    {% macro footer() %}{% include "article_footer.html" %}{% endmacro %} - {{ footer()|indent(10) }} + {{ footer()|rtrim|indent(10) }}
    {% endfor %} {% if articles_page.has_other_pages() %} {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %} - {{ pagination()|indent(6) }} + {{ pagination()|rtrim|indent(6) }} {% endif %} {% endblock %} diff --git a/pelican-theme/templates/category.html b/pelican-theme/templates/category.html index c3bf5d74..4eeaac35 100644 --- a/pelican-theme/templates/category.html +++ b/pelican-theme/templates/category.html @@ -35,7 +35,7 @@ {{ category|e }} {% endif %}

    {% if category.page.title %}{{ category.page.title }}{% else %}{{ category|e }}{% endif %}

    - {{ category.page.content|indent(8) }} + {{ category.page.content|rtrim|indent(8) }} {% endif %} {% endblock %} diff --git a/pelican-theme/templates/page.html b/pelican-theme/templates/page.html index 23bbaf6f..2328e101 100644 --- a/pelican-theme/templates/page.html +++ b/pelican-theme/templates/page.html @@ -63,7 +63,7 @@ {% endfor %} {% endif %} {% if page.html_header %} - {{ page.html_header|indent(2) }} + {{ page.html_header|rtrim|indent(2) }} {% endif %} {% endblock %} diff --git a/pelican-theme/templates/passthrough.html b/pelican-theme/templates/passthrough.html index d06be23b..bdf92b77 100644 --- a/pelican-theme/templates/passthrough.html +++ b/pelican-theme/templates/passthrough.html @@ -17,7 +17,7 @@ {% endfor %} {% endif %} {% if page.html_header %} - {{ page.html_header.strip()|indent(2) }} + {{ page.html_header|trim|indent(2) }} {% endif %} diff --git a/pelican-theme/templates/tag.html b/pelican-theme/templates/tag.html index b1cb113a..7ef0fd42 100644 --- a/pelican-theme/templates/tag.html +++ b/pelican-theme/templates/tag.html @@ -29,7 +29,7 @@ {% if tag.page and tag.page.content and articles_page.number == 1 %}

    {% if tag.page.title %}{{ tag.page.title }}{% else %}{{ tag|e }}{% endif %}

    - {{ tag.page.content|indent(8) }} + {{ tag.page.content|rtrim|indent(8) }}
    {% endif %} {% endblock %} -- 2.30.2