From 4e4d6bb11f417e28485b265510e554fc814c86ac Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 4 Oct 2016 21:27:30 +0100 Subject: Rename element_or_value to read_boolean_value --- mammoth/docx/body_xml.py | 14 +++++++------- 1 file 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") -- cgit v1.2.3