From 65834fa39ee1ea77ef5581bc11e4e6046c6499a6 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 17 Mar 2019 21:20:58 +0000 Subject: Pass styles into read_numbering_xml_element --- mammoth/docx/__init__.py | 14 +++++++------- mammoth/docx/numbering_xml.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'mammoth') 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) -- cgit v1.2.3