aboutsummaryrefslogtreecommitdiff
path: root/mammoth/docx/body_xml.py
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-03-20 19:12:21 +0000
committerMichael Williamson <mike@zwobble.org>2024-03-20 19:12:21 +0000
commit19a8412b0fdd6955b28042c470022cfbb8ff55e0 (patch)
tree8d6ed7f50db9ef29199c770503848ece8213b209 /mammoth/docx/body_xml.py
parent74d3543f6a7fa82d8f00cd8bdd6afc6763f7dfba (diff)
Prefer numbering properties to numbering from paragraph style
Diffstat (limited to 'mammoth/docx/body_xml.py')
-rw-r--r--mammoth/docx/body_xml.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/mammoth/docx/body_xml.py b/mammoth/docx/body_xml.py
index f880c72..005ad3d 100644
--- a/mammoth/docx/body_xml.py
+++ b/mammoth/docx/body_xml.py
@@ -236,17 +236,17 @@ def _create_reader(numbering, content_types, relationships, styles, docx_file, f
return results.warning("{0} style with ID {1} was referenced but not defined in the document".format(style_type, style_id))
def _read_numbering_properties(paragraph_style_id, element):
+ num_id = element.find_child_or_null("w:numId").attributes.get("w:val")
+ level_index = element.find_child_or_null("w:ilvl").attributes.get("w:val")
+ if num_id is not None and level_index is not None:
+ return numbering.find_level(num_id, level_index)
+
if paragraph_style_id is not None:
level = numbering.find_level_by_paragraph_style_id(paragraph_style_id)
if level is not None:
return level
- num_id = element.find_child_or_null("w:numId").attributes.get("w:val")
- level_index = element.find_child_or_null("w:ilvl").attributes.get("w:val")
- if num_id is None or level_index is None:
- return None
- else:
- return numbering.find_level(num_id, level_index)
+ return None
def _read_paragraph_indent(element):
attributes = element.attributes