chiark / gitweb /
Trim extra trailing newlines before passing it to Jinja's indent().
authorVladimír Vondruš <mosra@centrum.cz>
Sun, 7 Jul 2019 19:34:50 +0000 (21:34 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Sun, 7 Jul 2019 20:20:53 +0000 (22:20 +0200)
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.

23 files changed:
documentation/templates/doxygen/annotated.html
documentation/templates/doxygen/base-class-reference.html
documentation/templates/doxygen/base-reference.html
documentation/templates/doxygen/base.html
documentation/templates/doxygen/files.html
documentation/templates/doxygen/modules.html
documentation/templates/doxygen/namespaces.html
documentation/templates/doxygen/page.html
documentation/templates/doxygen/pages.html
documentation/templates/python/base.html
documentation/templates/python/classes.html
documentation/templates/python/modules.html
documentation/templates/python/pages.html
pelican-theme/templates/archives.html
pelican-theme/templates/article.html
pelican-theme/templates/article_badges.html
pelican-theme/templates/author.html
pelican-theme/templates/base.html
pelican-theme/templates/base_blog_section.html
pelican-theme/templates/category.html
pelican-theme/templates/page.html
pelican-theme/templates/passthrough.html
pelican-theme/templates/tag.html

index f86a76675246e9fe82794344a6c15c949ee69d69..a81e20311c09ddfc9ee176019af682b4f677cc75 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible{% if loop.depth > M_CLASS_TREE_EXPAND_LEVELS or (i.kind != 'namespace' and not M_EXPAND_INNER_TYPES) %} collapsed{% endif %}">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-doc">{{ i.brief }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index d20b3d47d90eaa1e38ee4feb4325364711c35227..abcb996cc8210708a7687c383600b37e52ab009d 100644 (file)
@@ -58,7 +58,7 @@
             <li>
               <a href="#{{ id }}">{{ name }}</a>
               <ul>
-{{ loop(children)|indent(4, true) }}
+{{ loop(children)|rtrim|indent(4, true) }}
               </ul>
             </li>
             {% else %}
index 82e0f145bf3bc7a40f4e749435a11101454f0719..0613dde452b7eeba18517df298125dbbda1f690d 100644 (file)
@@ -34,7 +34,7 @@
             <li>
               <a href="#{{ id }}">{{ name }}</a>
               <ul>
-{{ loop(children)|indent(4, true) }}
+{{ loop(children)|rtrim|indent(4, true) }}
               </ul>
             </li>
             {% else %}
index d98bc83d4d22d64e2ec8b4bc7f55801bd56dbbef..e06ff8a50a2f65e87e765ecbd05add0db0b23c48 100644 (file)
@@ -19,7 +19,7 @@
   <meta name="theme-color" content="{{ M_THEME_COLOR }}" />
   {% endif %}
   {% if M_HTML_HEADER %}
-  {{ M_HTML_HEADER|indent(2) }}
+  {{ M_HTML_HEADER|rtrim|indent(2) }}
   {% endif %}
 </head>
 <body>
           </form>
           <noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.{% if M_SEARCH_EXTERNAL_URL %} Enable it or <a href="{{ M_SEARCH_EXTERNAL_URL|replace('{query}', '') }}">use an external search engine</a>.{% endif %}</noscript>
           <div id="search-help" class="m-text m-dim m-text-center">
-            {{ M_SEARCH_HELP|indent(12) }}
+            {{ M_SEARCH_HELP|rtrim|indent(12) }}
           </div>
           <div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.{% if M_SEARCH_EXTERNAL_URL %}<br />Maybe try a full-text <a href="#" id="search-external" data-search-engine="{{ M_SEARCH_EXTERNAL_URL }}">search with external engine</a>?{% endif %}</div>
           <ul id="search-results"></ul>
index c2331ceadace8f9908ea78af0450b99dd46e2d00..972ca7d07747171b1fc4db1e39219c88f8e7103d 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible{% if loop.depth > M_FILE_TREE_EXPAND_LEVELS %} collapsed{% endif %}">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-doc">{{ i.brief }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index b59d47c1f12d500f11bce83f5c4a916671e1c98f..8487a1bd6b40a0a954f39af872583e10e71841ef 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)">module</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-doc">{{ i.brief }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index eb8d1cff1d03985198615dc6a151f7daa06d5d15..986ab38c8141c843243463ced8d62b7bcf3ce755 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-doc">{{ i.brief }}</span>
             <ul class="m-doc">
-{{ loop(i.children|selectattr('kind', 'equalto', 'namespace'))|indent(4, true) }}
+{{ loop(i.children|selectattr('kind', 'equalto', 'namespace'))|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index 82d8087b73050e6262166d89b728ba35bcc5f225..473d30f339a54e8692528ae951094b5adfd06803 100644 (file)
@@ -30,7 +30,7 @@
             <li>
               <a href="#{{ id }}">{{ name }}</a>
               <ul>
-{{ loop(children)|indent(4, true) }}
+{{ loop(children)|rtrim|indent(4, true) }}
               </ul>
             </li>
             {% else %}
index ac812fb96326aecd39f28c4e4b42a758ab05bbba..8d52dd8a9c210ab1ea42c61daf5946b8ab620da9 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)"></a><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a>{% if i.is_deprecated %} <span class="m-label m-danger">deprecated</span>{% endif %} <span class="m-doc">{{ i.brief }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index 6c61189f708680692f9d1be9705f189060275384..aaa3197f3cbde1e4db9e16b31558b8443844120e 100644 (file)
@@ -19,7 +19,7 @@
   <meta name="theme-color" content="{{ THEME_COLOR }}" />
   {% endif %}
   {% if HTML_HEADER %}
-  {{ HTML_HEADER|indent(2) }}
+  {{ HTML_HEADER|rtrim|indent(2) }}
   {% endif %}
 </head>
 <body>
           </form>
           <noscript class="m-text m-danger m-text-center">Unlike everything else in the docs, the search functionality <em>requires</em> JavaScript.{% if SEARCH_EXTERNAL_URL %} Enable it or <a href="{{ SEARCH_EXTERNAL_URL|replace('{query}', '') }}">use an external search engine</a>.{% endif %}</noscript>
           <div id="search-help" class="m-text m-dim m-text-center">
-            {{ SEARCH_HELP|render_rst|indent(12) }}
+            {{ SEARCH_HELP|render_rst|rtrim|indent(12) }}
           </div>
           <div id="search-notfound" class="m-text m-warning m-text-center">Sorry, nothing was found.{% if SEARCH_EXTERNAL_URL %}<br />Maybe try a full-text <a href="#" id="search-external" data-search-engine="{{ SEARCH_EXTERNAL_URL }}">search with external engine</a>?{% endif %}</div>
           <ul id="search-results"></ul>
         {% if FINE_PRINT == '[default]' %}
         <p>{{ PROJECT_TITLE }}{% if PROJECT_SUBTITLE %} {{ PROJECT_SUBTITLE }}{% endif %}. Created with <a href="https://mcss.mosra.cz/documentation/python/">m.css Python doc generator</a>.</p>
         {% else %}
-        {{ FINE_PRINT|render_rst|indent(8) }}
+        {{ FINE_PRINT|render_rst|rtrim|indent(8) }}
         {% endif %}
       </div>
     </div>
index 2f9404ddd5437ea259fe3ce3d0136b86f8274b82..8b0b3bdbc2bfaca981dc67bf1cb12bc4ad62b314 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible{% if loop.depth > CLASS_INDEX_EXPAND_LEVELS or (i.kind != 'module' and not CLASS_INDEX_EXPAND_INNER) %} collapsed{% endif %}">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index 8264d2fc9960003d187744cbf7fd2584328784c0..cd954c9b131eb75d06cacde3d7a126b7326f1d6a 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)">{{ i.kind }}</a> <a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
-{{ loop(i.children|selectattr('kind', 'equalto', 'module'))|indent(4, true) }}
+{{ loop(i.children|selectattr('kind', 'equalto', 'module'))|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index 25c40990510d93d35faf85048082542642d66dc2..629d7160b05047e8ee239a711fc96c278e96c036 100644 (file)
@@ -9,7 +9,7 @@
           <li class="m-doc-collapsible">
             <a href="#" onclick="return toggle(this)"></a><a href="{{ i.url }}" class="m-doc">{{ i.name }}</a> <span class="m-doc">{{ i.summary }}</span>
             <ul class="m-doc">
-{{ loop(i.children)|indent(4, true) }}
+{{ loop(i.children)|rtrim|indent(4, true) }}
             </ul>
           </li>
           {% else %}
index 2332d95c02eaf8dcd6ac9ce94e182e9ed8869a8c..7ccd07d0563540648b987273a6f3c54a198e647b 100644 (file)
@@ -54,7 +54,7 @@
       {% for article in article_list %}
       <article>
         {% 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 %}
         <footer>
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
-          {{ footer()|indent(10) }}
+          {{ footer()|rtrim|indent(10) }}
         </footer>
         {% if not show_content %}
         <div class="m-clearfix-l"></div>
@@ -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 %}
     </div>
 {% endblock %}
index 266e132ca67dadbd5bd490a41ed3bd3ee5b9451d..7b09f18b0997e53e1fc9468dbcaa957cdc11bd77 100644 (file)
@@ -96,7 +96,7 @@
 {{ article.content|trim }}
 <!-- /content -->
           {% if article.category.badge or (article.author and article.author.badge) %}
-          {{ badges()|indent(10) }}
+          {{ badges()|rtrim|indent(10) }}
           {% endif %}
         </div>
       </div>
       <div class="m-row">
         <div class="m-col-m-10 m-push-m-1 m-nopadb">
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
-          {{ footer()|indent(10) }}
+          {{ footer()|rtrim|indent(10) }}
         </div>
       </div>
     </footer>
   {% else %}
     <article class="m-col-m-10 m-nopadb">
       {% macro header() %}{% include "article_header.html" %}{% endmacro %}
-      {{ header()|indent(6) }}
+      {{ header()|rtrim|indent(6) }}
       <div class="m-clearfix-l"></div>
       {% 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 %}
 <!-- content -->
 <!-- /content -->
       {% endif %}
       {% if article.category.badge or (article.author and article.author.badge) %}
-      {{ badges()|indent(6) }}
+      {{ badges()|rtrim|indent(6) }}
       {% endif %}
       <footer>
         {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
-        {{ footer()|indent(8) }}
+        {{ footer()|rtrim|indent(8) }}
       </footer>
     </article>
     {% endif %}
index e62c9d0f8a3c4807e7843f5ea4daf6cac0deffe6..95f129c9faf728f78e616a90dfa3a0382ff7166d 100644 (file)
@@ -4,7 +4,7 @@
   <img src="{{ article.author.image|expand_link(article)|e }}" alt="{{ article.author|e }}" />
   {% endif %}
   <h3>About the author</h3>
-  {{ article.author.badge|expand_links(article)|indent(2) }}
+  {{ article.author.badge|expand_links(article)|rtrim|indent(2) }}
 </div>
 {% endif %}
 {% if article.category.badge %}
@@ -13,6 +13,6 @@
   <img src="{{ article.category.image|expand_link(article)|e }}" alt="{{ article.category|e }}" />
   {% endif %}
   <h3>{% if article.category.badge_title %}{{ article.category.badge_title }}{% else %}{{ article.category|e }}{% endif %}</h3>
-  {{ article.category.badge|expand_links(article)|indent(2) }}
+  {{ article.category.badge|expand_links(article)|rtrim|indent(2) }}
 </div>
 {% endif %}
index c919d7f59c9606584352b91aa11f189896fa0404..917b1f8718b07dd247790879ef2704cff1dc8597 100644 (file)
@@ -41,7 +41,7 @@
         <img src="{{ author.page.image|expand_link(author.page)|e }}" alt="{{ author|e }}" />
         {% endif %}
         <h3>{% if author.page.title %}{{ author.page.title }}{% else %}{{ author|e }}{% endif %}</h3>
-        {{ author.page.content|indent(8) }}
+        {{ author.page.content|rtrim|indent(8) }}
       </div>
       {% endif %}
 {% endblock %}
index 9c6d1e67b51ffacef0fcc9a51a2ae96631dd543e..71442dfbf3c120154b2ad021b1345e8693cdcd5e 100644 (file)
     {% if not M_FINE_PRINT is defined or M_FINE_PRINT %}
     <div class="m-row">
       <div class="m-col-l-10 m-push-l-1">
-        {{ (M_FINE_PRINT or SITENAME + ". Powered by `Pelican <https://getpelican.com>`_ and `m.css <https://mcss.mosra.cz>`_.")|render_rst|indent(8) }}
+        {{ (M_FINE_PRINT or SITENAME + ". Powered by `Pelican <https://getpelican.com>`_ and `m.css <https://mcss.mosra.cz>`_.")|render_rst|rtrim|indent(8) }}
       </div>
     </div>
     {% endif %}
index 5d10e120459bb31be18c2744aa6020fe5b2ffc85..327ad15066cd56ae6b2626c0933e0dd3888dbf9e 100644 (file)
       {% for article in articles_page.object_list %}
       <article>
         {% macro header() %}{% include "article_header.html" %}{% endmacro %}
-        {{ header()|indent(8) }}
+        {{ header()|rtrim|indent(8) }}
         <footer>
           {% macro footer() %}{% include "article_footer.html" %}{% endmacro %}
-          {{ footer()|indent(10) }}
+          {{ footer()|rtrim|indent(10) }}
         </footer>
         <div class="m-clearfix-l"></div>
       </article>
       {% endfor %}
       {% if articles_page.has_other_pages() %}
       {% macro pagination() %}{% include 'pagination.html' %}{% endmacro %}
-      {{ pagination()|indent(6) }}
+      {{ pagination()|rtrim|indent(6) }}
       {% endif %}
     </div>
 {% endblock %}
index c3bf5d74c673cdad99c9ea41234c8abf1863f44b..4eeaac35628c747249964854618643761cb96458 100644 (file)
@@ -35,7 +35,7 @@
         <img src="{{ category.page.image|expand_link(category.page)|e }}" alt="{{ category|e }}" />
         {% endif %}
         <h3>{% if category.page.title %}{{ category.page.title }}{% else %}{{ category|e }}{% endif %}</h3>
-        {{ category.page.content|indent(8) }}
+        {{ category.page.content|rtrim|indent(8) }}
       </div>
       {% endif %}
 {% endblock %}
index 23bbaf6fe718a8e7fd77b33fb9cf37b98be6a6ee..2328e10160fe2925310d447e855ebe3bf5549089 100644 (file)
@@ -63,7 +63,7 @@
   {% endfor %}
   {% endif %}
   {% if page.html_header %}
-  {{ page.html_header|indent(2) }}
+  {{ page.html_header|rtrim|indent(2) }}
   {% endif %}
 {% endblock %}
 
index d06be23b99f904dd306a834565a6360a55894f50..bdf92b773fccf2980531a680251803025de7242e 100644 (file)
@@ -17,7 +17,7 @@
   {% endfor %}
   {% endif %}
   {% if page.html_header %}
-  {{ page.html_header.strip()|indent(2) }}
+  {{ page.html_header|trim|indent(2) }}
   {% endif %}
 </head>
 <body>
index b1cb113a25fdc7bb94d7506c050c2b777d2541bf..7ef0fd42fadce453f6ad0e643563aeae8932d7a9 100644 (file)
@@ -29,7 +29,7 @@
       {% if tag.page and tag.page.content and articles_page.number == 1 %}
       <div class="m-block m-info">
         <h3>{% if tag.page.title %}{{ tag.page.title }}{% else %}{{ tag|e }}{% endif %}</h3>
-        {{ tag.page.content|indent(8) }}
+        {{ tag.page.content|rtrim|indent(8) }}
       </div>
       {% endif %}
 {% endblock %}