aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2019-03-17 21:20:58 +0000
committerMichael Williamson <mike@zwobble.org>2019-03-17 21:20:58 +0000
commit65834fa39ee1ea77ef5581bc11e4e6046c6499a6 (patch)
tree6fc2bd56ec9938fcfd9a0d02dc522cf8bd270925 /mammoth
parent2c01dcb90076ebaeee903302f7948a745b1abd87 (diff)
Pass styles into read_numbering_xml_element
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/docx/__init__.py14
-rw-r--r--mammoth/docx/numbering_xml.py2
2 files changed, 8 insertions, 8 deletions
diff --git a/mammoth/docx/__init__.py b/mammoth/docx/__init__.py
index 517683d..63a634c 100644
--- a/mammoth/docx/__init__.py
+++ b/mammoth/docx/__init__.py
@@ -142,13 +142,6 @@ def _part_with_body_reader(document_path, zip_file, part_paths):
empty_content_types,
)
- numbering = _try_read_entry_or_default(
- zip_file,
- part_paths.numbering,
- read_numbering_xml_element,
- default=Numbering(abstract_nums={}, nums={}),
- )
-
styles = _try_read_entry_or_default(
zip_file,
part_paths.styles,
@@ -156,6 +149,13 @@ def _part_with_body_reader(document_path, zip_file, part_paths):
Styles.EMPTY,
)
+ numbering = _try_read_entry_or_default(
+ zip_file,
+ part_paths.numbering,
+ lambda element: read_numbering_xml_element(element, styles=styles),
+ default=Numbering(abstract_nums={}, nums={}),
+ )
+
def read_part(name, reader, default=_undefined):
relationships = _read_relationships(zip_file, _find_relationships_path_for(name))
diff --git a/mammoth/docx/numbering_xml.py b/mammoth/docx/numbering_xml.py
index 8d9af70..3a0645e 100644
--- a/mammoth/docx/numbering_xml.py
+++ b/mammoth/docx/numbering_xml.py
@@ -3,7 +3,7 @@ import cobble
from ..documents import numbering_level
-def read_numbering_xml_element(element):
+def read_numbering_xml_element(element, styles):
abstract_nums = _read_abstract_nums(element)
nums = _read_nums(element)
return Numbering(abstract_nums=abstract_nums, nums=nums)