@@ -210,7 +210,8 @@ def v_merge(m1):
210
210
return re .sub (
211
211
r"(</w:tcPr[ >].*?<w:t(?:.*?)>)(.*?)(?:{%\s*vm\s*%})(.*?)(</w:t>)" ,
212
212
v_merge ,
213
- m .group (), # Everything between ``</w:tc>`` and ``</w:tc>`` with ``{% vm %}`` inside.
213
+ m .group (),
214
+ # Everything between ``</w:tc>`` and ``</w:tc>`` with ``{% vm %}`` inside.
214
215
flags = re .DOTALL ,
215
216
)
216
217
@@ -310,7 +311,7 @@ def render_xml_part(self, src_xml, part, context, jinja_env=None):
310
311
line_number = max (exc .lineno - 4 , 0 )
311
312
exc .docx_context = map (
312
313
lambda x : re .sub (r"<[^>]+>" , "" , x ),
313
- src_xml .splitlines ()[line_number : (line_number + 7 )],
314
+ src_xml .splitlines ()[line_number : (line_number + 7 )],
314
315
)
315
316
316
317
raise exc
@@ -352,15 +353,22 @@ def render_properties(
352
353
setattr (self .docx .core_properties , prop , rendered )
353
354
354
355
def render_footnotes (
355
- self , context : Dict [str , Any ], jinja_env : Optional [Environment ] = None
356
+ self , context : Dict [str , Any ], jinja_env : Optional [Environment ] = None
356
357
) -> None :
357
358
if jinja_env is None :
358
359
jinja_env = Environment ()
359
360
360
361
for section in self .docx .sections :
361
362
for part in section .part .package .parts :
362
- if part .content_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml' :
363
- xml = self .patch_xml (part .blob .decode ('utf-8' ) if isinstance (part .blob , bytes ) else part .blob )
363
+ if part .content_type == (
364
+ "application/vnd.openxmlformats-officedocument"
365
+ ".wordprocessingml.footnotes+xml"
366
+ ):
367
+ xml = self .patch_xml (
368
+ part .blob .decode ("utf-8" )
369
+ if isinstance (part .blob , bytes )
370
+ else part .blob
371
+ )
364
372
xml = self .render_xml_part (xml , part , context , jinja_env )
365
373
part ._blob = xml
366
374
0 commit comments