diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index 0515507..5836b8d 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -4,7 +4,7 @@ Created : 2015-03-12 @author: Eric Lapouyade """ -__version__ = '0.16.1' +__version__ = '0.16.2' # flake8: noqa from .inline_image import InlineImage diff --git a/docxtpl/template.py b/docxtpl/template.py index b23a454..0fe8bc8 100644 --- a/docxtpl/template.py +++ b/docxtpl/template.py @@ -126,7 +126,7 @@ class DocxTemplate(object): # {%- will merge with previous paragraph text src_xml = re.sub(r'(?:(?!).)*?{%-', '{%', src_xml, flags=re.DOTALL) # -%} will merge with next paragraph text - src_xml = re.sub(r'-%}(?:(?!]).)*?]*?>', '%}', src_xml, flags=re.DOTALL) + src_xml = re.sub(r'-%}(?:(?!]|{%|{{).)*?]*?>', '%}', src_xml, flags=re.DOTALL) for y in ['tr', 'tc', 'p', 'r']: # replace into xml code the row/paragraph/run containing diff --git a/tests/templates/merge_paragraph_tpl.docx b/tests/templates/merge_paragraph_tpl.docx index 9d5e388..3cd0def 100644 Binary files a/tests/templates/merge_paragraph_tpl.docx and b/tests/templates/merge_paragraph_tpl.docx differ