Added test files for the auto escape.

This commit is contained in:
Max P 2018-11-05 18:29:33 -08:00
parent 40bf39cde7
commit 7e72603441
3 changed files with 3 additions and 2 deletions

View File

@ -1,12 +1,13 @@
from docxtpl import * from docxtpl import *
tpl = DocxTemplate("test_files/escape_tpl.docx") tpl = DocxTemplate("test_files/escape_tpl_auto.docx")
context = {'myvar': R('"less than" must be escaped : <, this can be done with RichText() or R()'), context = {'myvar': R('"less than" must be escaped : <, this can be done with RichText() or R()'),
'myescvar':'It can be escaped with a "|e" jinja filter in the template too : < ', 'myescvar':'It can be escaped with a "|e" jinja filter in the template too : < ',
'nlnp' : R('Here is a multiple\nlines\nstring\aand some\aother\aparagraphs\aNOTE: the current character styling is removed'), 'nlnp' : R('Here is a multiple\nlines\nstring\aand some\aother\aparagraphs\aNOTE: the current character styling is removed'),
'mylisting': Listing('the listing\nwith\nsome\nlines\nand special chars : <>&'), 'mylisting': Listing('the listing\nwith\nsome\nlines\nand special chars : <>&'),
'autoescape': """These string should be auto escaped for an XML Word document which may contain <, >, &, ", and '."""
} }
tpl.render(context) tpl.render(context)
tpl.save("test_files/escape.docx") tpl.save("test_files/escape_auto.docx")

Binary file not shown.

Binary file not shown.