From d0f2b071a967f100e9dc3dcffdb9fe220cac0a9d Mon Sep 17 00:00:00 2001 From: Pavel 'LEdoian' Turinsky Date: Sun, 14 Feb 2021 03:24:52 +0100 Subject: [PATCH] Jinja: Forbid stripping newlines This creates a bit prettier theme output. When newlines from ends are stripped, constructions like ```
{% include "header.html" %}
``` end compiled with the ending tag at last line of the include I think it is a bit shame that Pelican does not have any method to configure Jinja from the theme itself, since this is more theme-related than content-related. --- pelicanconf.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pelicanconf.py b/pelicanconf.py index 7c63365..64f535e 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -13,6 +13,14 @@ RELATIVE_URLS = True PATH = 'content' THEME = 'test-theme' +JINJA_ENVIRONMENT = { + # The default: + 'trim_blocks': True, + 'lstrip_blocks': True, + + # Custom + 'keep_trailing_newline': True, + } TIMEZONE = 'Europe/Prague'