Fix '{% vm %}' tag for table cells with XML attributes
Updated regex to match cell content inside '<w:t>' even if <w:t> has XML attributes such as 'xml:space="preserve"'. Updated test to have this kind of '<w:t>'.
This commit is contained in:
parent
4b0b1da2eb
commit
98ad7eebf7
@ -103,7 +103,7 @@ class DocxTemplate(object):
|
||||
m1.group(4) # ``</w:t>``.
|
||||
)
|
||||
return re.sub(
|
||||
r'(</w:tcPr>.*?<w:t>)(.*?)(?:{%\s*vm\s*%})(.*?)(</w:t>)',
|
||||
r'(</w:tcPr[ >].*?<w:t(?:.*?)>)(.*?)(?:{%\s*vm\s*%})(.*?)(</w:t>)',
|
||||
vMerge,
|
||||
m.group(), # Everything between ``</w:tc>`` and ``</w:tc>`` with ``{% vm %}`` inside.
|
||||
flags=re.DOTALL,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user