Fix bug where one is using '%' (modulo operator) inside a tag

This commit is contained in:
Eric Lapouyade 2017-02-20 09:12:54 +01:00
parent 84062c0c28
commit c35a4ed676
12 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,7 @@
0.3.5 (2017-02-20)
------------------
- Fix bug where one is using '%' (modulo operator) inside a tag
0.3.4 (2017-02-14)
------------------
- Add Listing class to manage \n and \a (new paragraph) and escape text AND keep current styling

View File

@ -5,7 +5,7 @@ Created : 2015-03-12
@author: Eric Lapouyade
'''
__version__ = '0.3.4'
__version__ = '0.3.5'
from lxml import etree
from docx import Document
@ -72,7 +72,7 @@ class DocxTemplate(object):
def clean_tags(m):
return m.group(0).replace(r"&#8216;","'").replace('&lt;','<').replace('&gt;','>')
src_xml = re.sub(r'(?<=\{[\{%])([^\}%]*)(?=[\}%]})',clean_tags,src_xml)
src_xml = re.sub(r'(?<=\{[\{%])(.*?)(?=[\}%]})',clean_tags,src_xml)
return src_xml

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.