diff options
| author | Michael Williamson <mike@zwobble.org> | 2020-09-09 11:21:47 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2020-09-09 11:21:47 +0100 |
| commit | 32231b57c13c6c7c72d7ab9606cf939b03e38849 (patch) | |
| tree | 1824666b4a11aa890ba353535fb113a036857e56 /mammoth/docx | |
| parent | 144515de86dba289edf68ec9acd6fa005fc2a4ed (diff) | |
Handle underline elements where w:val is "none"
Diffstat (limited to 'mammoth/docx')
| -rw-r--r-- | mammoth/docx/body_xml.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index f0aab84..dcc704b 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -89,7 +89,7 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f is_bold = read_boolean_element(properties.find_child("w:b")) is_italic = read_boolean_element(properties.find_child("w:i")) - is_underline = read_boolean_element(properties.find_child("w:u")) + is_underline = read_underline_element(properties.find_child("w:u")) is_strikethrough = read_boolean_element(properties.find_child("w:strike")) is_small_caps = read_boolean_element(properties.find_child("w:smallCaps")) @@ -123,6 +123,8 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f def read_boolean_element(element): return element and element.attributes.get("w:val") not in ["false", "0"] + def read_underline_element(element): + return element and element.attributes.get("w:val") not in ["false", "0", "none"] def paragraph(element): properties = element.find_child_or_null("w:pPr") |
