diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-10-04 21:27:30 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-10-04 21:27:30 +0100 |
| commit | 4e4d6bb11f417e28485b265510e554fc814c86ac (patch) | |
| tree | 8079875d55c0799baedfd8a9eeb2993f5e918549 /mammoth | |
| parent | 8a9191e21a1cd37c6326f38c9430b33548ac7943 (diff) | |
Rename element_or_value to read_boolean_value
Diffstat (limited to 'mammoth')
| -rw-r--r-- | mammoth/docx/body_xml.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py index 92ac085..2e16c26 100644 --- a/mammoth/docx/body_xml.py +++ b/mammoth/docx/body_xml.py @@ -71,9 +71,6 @@ 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") @@ -81,10 +78,10 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f .find_child_or_null("w:vertAlign") \ .attributes.get("w:val") - 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")) + 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_strikethrough = read_boolean_element(properties.find_child("w:strike")) return _ReadResult.map_results( _read_run_style(properties), @@ -100,6 +97,9 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f vertical_alignment=vertical_alignment, )) + def read_boolean_element(element): + return element and element.attributes.get("w:val") != "false" + def paragraph(element): properties = element.find_child_or_null("w:pPr") |
