feat: export editable named Word styles and release 0.5.0
This commit is contained in:
@@ -80,6 +80,8 @@ def test_word_export_preserves_cjk_bold_and_body_boundaries(tmp_path, engine):
|
||||
path = export_markdown_to_docx(SCREENSHOT_SOURCE, tmp_path / (engine + '.docx'), engine=engine)
|
||||
with zipfile.ZipFile(path) as package:
|
||||
root = ET.fromstring(package.read('word/document.xml'))
|
||||
from docx_assertions import effective_document
|
||||
root = effective_document(root, ET.fromstring(package.read('word/styles.xml')))
|
||||
ns = {'w': 'http://schemas.openxmlformats.org/wordprocessingml/2006/main'}
|
||||
all_text = ''.join(root.xpath('//w:t/text()', namespaces=ns))
|
||||
bold_text = ''.join(root.xpath('//w:r[w:rPr/w:b[not(@w:val="0")]]/w:t/text()', namespaces=ns))
|
||||
|
||||
Reference in New Issue
Block a user