From 9083bfc2305da817b8b7152394a9698f765d37bc Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Wed, 11 Jan 2023 16:24:08 +0100 Subject: [PATCH] Trim whitespaces around Jinja2 blocks --- sphinx_rtd_theme/layout.html | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/sphinx_rtd_theme/layout.html b/sphinx_rtd_theme/layout.html index 00705259c..f612bd6be 100644 --- a/sphinx_rtd_theme/layout.html +++ b/sphinx_rtd_theme/layout.html @@ -54,19 +54,23 @@ {%- endif -%} - {#- CANONICAL URL #} - {# NB! pageurl is currently a non-documented template context variable! #} - {# pageurl implementation: https://www.sphinx-doc.org/en/master/_modules/sphinx/builders/html.html #} - {%- if pageurl %} - {# pageurl implementation wrongly: adds .html for the dirhtml builder's pageurl #} - {# Workaround for: https://github.com/sphinx-doc/sphinx/issues/9730 #} - {# Once a fix is released in Sphinx, put an upper bound on the Sphinx version for the workaround #} - {% if builder == 'dirhtml' and pageurl.endswith('.html') %} - {# This expression trims away .html and adds a / #} + {#- + CANONICAL URL + NB! pageurl is currently a non-documented template context variable! + pageurl implementation: https://www.sphinx-doc.org/en/master/_modules/sphinx/builders/html.html + -#} + {%- if pageurl -%} + {#- + pageurl implementation wrongly: adds .html for the dirhtml builder's pageurl + Workaround for: https://github.com/sphinx-doc/sphinx/issues/9730 + Once a fix is released in Sphinx, put an upper bound on the Sphinx version for the workaround + -#} + {%- if builder == 'dirhtml' and pageurl.endswith('.html') -%} + {#- This expression trims away .html and adds a / -#} - {% else %} + {%- else -%} - {% endif %} + {%- endif -%} {%- endif -%} {#- JAVASCRIPTS #}