This commit is contained in:
Eric Lapouyade 2020-11-09 09:12:16 +01:00
parent 53d582c407
commit 79994ed2c8
4 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,7 @@
0.11.2 (2020-11-09)
-------------------
- fix #323
0.11.1 (2020-10-27)
-------------------
- fix #320

View File

@ -4,7 +4,7 @@ Created : 2015-03-12
@author: Eric Lapouyade
"""
__version__ = '0.11.1'
__version__ = '0.11.2'
import functools
import io
@ -246,14 +246,14 @@ class DocxTemplate(object):
return xml
def resolve_run(paragraph_properties, m):
run_properties = re.search(r'<w:rPr>.*</w:rPr>', m.group(0))
run_properties = re.search(r'<w:rPr>.*?</w:rPr>', m.group(0))
run_properties = run_properties.group(0) if run_properties else ''
return re.sub(r'<w:t(?:[^>]*)?>.*?</w:t>',
lambda x: resolve_text(run_properties, paragraph_properties, x), m.group(0),
flags=re.DOTALL)
def resolve_paragraph(m):
paragraph_properties = re.search(r'<w:pPr>.*</w:pPr>', m.group(0))
paragraph_properties = re.search(r'<w:pPr>.*?</w:pPr>', m.group(0))
paragraph_properties = paragraph_properties.group(0) if paragraph_properties else ''
return re.sub(r'<w:r(?:[^>]*)?>.*?</w:r>',
lambda x: resolve_run(paragraph_properties, x),

View File

@ -21,6 +21,7 @@ Here is a new paragraph\a
Here is a page break : \f
That's it
""",
'some_html' : 'HTTP/1.1 200 OK\nServer: Apache-Coyote/1.1\nCache-Control: no-store\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\nPragma: no-cache\nContent-Type: text/html;charset=UTF-8\nContent-Language: zh-CN\nDate: Thu, 22 Oct 2020 10:59:40 GMT\nContent-Length: 9866\n\n<html>\n<head>\n <title>Struts Problem Report</title>\n <style>\n \tpre {\n\t \tmargin: 0;\n\t padding: 0;\n\t } \n </style>\n</head>\n<body>\n...\n</body>\n</html>',
}
tpl.render(context)

Binary file not shown.