diff options
| author | Sir Mix-A-Lot <cangotep2p@gmail.com> | 2016-10-04 17:25:17 -0300 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-10-04 21:25:17 +0100 |
| commit | be2ecb19a55349c86d384a10feacfa684376fa8f (patch) | |
| tree | 10901ade7ec07562c78670bf57ee8d343f84f9aa /mammoth/docx/body_xml.py | |
| parent | c0875398b9d8d4c3465c648fe809a76c7c7971f0 (diff) | |
Ignore run boolean elements that have value of false
Diffstat (limited to 'mammoth/docx/body_xml.py')
| -rw-r--r-- | mammoth/docx/body_xml.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index b5e2997..92ac085 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -71,7 +71,9 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f def text(element): return _success(documents.Text(_inner_text(element))) - + + def element_or_value(element): + return element and element.attributes.get("w:val") != "false" def run(element): properties = element.find_child_or_null("w:rPr") @@ -79,10 +81,10 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f .find_child_or_null("w:vertAlign") \ .attributes.get("w:val") - is_bold = properties.find_child("w:b") - is_italic = properties.find_child("w:i") - is_underline = properties.find_child("w:u") - is_strikethrough = properties.find_child("w:strike") + is_bold = element_or_value(properties.find_child("w:b")) + is_italic = element_or_value(properties.find_child("w:i")) + is_underline = element_or_value(properties.find_child("w:u")) + is_strikethrough = element_or_value(properties.find_child("w:strike")) return _ReadResult.map_results( _read_run_style(properties), |
