fix template filter with quote
This commit is contained in:
parent
423b3005ef
commit
0f1569188d
@ -1,3 +1,7 @@
|
||||
0.1.5 (2015-05-11)
|
||||
------------------
|
||||
- fix template filter with quote
|
||||
|
||||
0.1.4 (2015-03-27)
|
||||
------------------
|
||||
- add RichText support
|
||||
|
||||
@ -5,7 +5,7 @@ Created : 2015-03-12
|
||||
@author: Eric Lapouyade
|
||||
'''
|
||||
|
||||
__version__ = '0.1.4'
|
||||
__version__ = '0.1.5'
|
||||
|
||||
from lxml import etree
|
||||
from docx import Document
|
||||
@ -54,9 +54,13 @@ class DocxTemplate(object):
|
||||
pat = r'<w:%(y)s[ >](?:(?!<w:%(y)s[ >]).)*({%%|{{)%(y)s ([^}%%]*(?:%%}|}})).*?</w:%(y)s>' % {'y':y}
|
||||
src_xml = re.sub(pat, r'\1 \2',src_xml,flags=re.DOTALL)
|
||||
|
||||
src_xml = src_xml.replace(r"‘","'")
|
||||
|
||||
return src_xml
|
||||
|
||||
def render_xml(self,src_xml,context):
|
||||
with open('/tmp/titi','w') as fh:
|
||||
fh.write(src_xml)
|
||||
template = Template(src_xml)
|
||||
dst_xml = template.render(context)
|
||||
dst_xml = dst_xml.replace('{_{','{{').replace('}_}','}}').replace('{_%','{%').replace('%_}','%}')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user