elapouya / python-docx-template

Use a docx as a jinja2 template
GNU Lesser General Public License v2.1
1.98k stars 385 forks source link

Escaping delimiters cannot render properly #548

Open trouver opened 3 months ago

trouver commented 3 months ago

Escaping delimiters cannot be rendered correctly in the docx template under certain circumstances.

Test case

from docxtpl import DocxTemplate

def docxtpl_test():
    tpl = DocxTemplate('escaping_delimiters_test_tpl.docx')
    content = {}
    tpl.render(content)
    tpl.save('escaping_delimiters_test_res.docx')

if __name__ == '__main__':
    docxtpl_test()

docx template

escaping_delimiters_test_tpl.docx

Local test results

tpl_and_res

Local test environment

OS: Windows 10 python version: python 3.10.9 docxtpl version: 0.17.0