From bb3a7078912a4f0a2e3d9636a44d77df38c285ad Mon Sep 17 00:00:00 2001 From: drfho Date: Mon, 9 Dec 2024 06:33:40 +0100 Subject: [PATCH] enforce ZMSGraphic caption --- .../manage_export_pydocx/manage_export_pydocx.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Products/zms/conf/metacmd_manager/manage_export_pydocx/manage_export_pydocx.py b/Products/zms/conf/metacmd_manager/manage_export_pydocx/manage_export_pydocx.py index 212993e6d..75025e772 100644 --- a/Products/zms/conf/metacmd_manager/manage_export_pydocx/manage_export_pydocx.py +++ b/Products/zms/conf/metacmd_manager/manage_export_pydocx/manage_export_pydocx.py @@ -1261,9 +1261,16 @@ def manage_export_pydocx(self, save_file=True, file_name=None): # ############################################# # [4] CAPTION TEXT-BLOCK elif v and block['docx_format']=='Caption': - # if re.match(r'^\[Abb\. e\d+\] .*', v): p = doc.add_paragraph(style='Caption') - p.add_run(v) + if re.match(r'^\[Abb\. e\d+\] .*', v): + re_list = re.split(r'^(\[Abb. e\d+\]) (.*)',v) + v1 = re_list[1] + v2 = BeautifulSoup(re_list[2], 'html.parser').get_text() + p.add_run(v1).font.italic = False + p.add_run(' ') + p.add_run(v2) + else: + p.add_run(v) prepend_bookmark(p, block['id']) # #############################################