diff --git a/CHANGES.rst b/CHANGES.rst index 1b1c3d2..71bff4a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,7 @@ +0.1.5 (2015-05-11) +------------------ +- fix template filter with quote + 0.1.4 (2015-03-27) ------------------ - add RichText support diff --git a/docxtpl/__init__.py b/docxtpl/__init__.py index 7b8adc1..69b4b19 100644 --- a/docxtpl/__init__.py +++ b/docxtpl/__init__.py @@ -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 @@ -53,10 +53,14 @@ class DocxTemplate(object): # This is mandatory to have jinja2 generating correct xml code pat = r'](?:(?!]).)*({%%|{{)%(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('%_}','%}') diff --git a/setup.py b/setup.py index b3feb76..4a81c34 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ News """ % read('README', 'CHANGES') setup(name='docxtpl', - version='0.1.4', + version='0.1.5', description='Python docx template engine', long_description=long_description, classifiers=[