Skip to content
Snippets Groups Projects
Commit 06f5528f authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Disabled evaluation of standard Jinja blocks ({% ... %}) and comments ({# ......

Disabled evaluation of standard Jinja blocks ({% ... %}) and comments ({# ... #}). This allows handling templates with standard Jinja code and shell scripts using array length expansion (${#ARRAY})
parent e86ed113
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,9 @@ Templates
---------
* Changed retrieval of templates for config files that alter EXP_ID
Now tries config file name before using EXP_ID as template name
* Disabled evaluation of standard Jinja blocks ({% ... %}) and comments
({# ... #}). This allows handling templates with standard Jinja code and shell
scripts using array length expansion (${#ARRAY})
Release 0.4.2
=============
......
......@@ -297,6 +297,8 @@ template_env = Environment(
variable_end_string = '}',
line_statement_prefix = '#%',
line_comment_prefix = '#%#',
block_start_string = '{%DiSaBlEdAnDuNlIkElY',
comment_start_string = '{#DiSaBlEdAnDuNlIkElY',
extensions=['jinja2.ext.do']
)
......
......@@ -407,6 +407,24 @@ class ContentTestCase(MkexpTestCase):
result = align(result)
self.assertMultiLineEqual(expected, result)
class JinjaTemplateTestCase(MkexpSimpleTestCase):
def test_ignore_blocks(self):
self.run_test("""
{% set answer = 42 %}
""", """
{% set answer = 42 %}
""")
def test_ignore_comments(self):
self.run_test("""
{# no comment #}
${#ARRAY}
""", """
{# no comment #}
${#ARRAY}
""")
class DefaultEnvironmentTestCase(MkexpSimpleTestCase):
def test_basic(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment