From 2c01dcb90076ebaeee903302f7948a745b1abd87 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 17 Mar 2019 18:37:32 +0000 Subject: Create object for abstract nums --- mammoth/docx/numbering_xml.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mammoth') diff --git a/mammoth/docx/numbering_xml.py b/mammoth/docx/numbering_xml.py index 31a0d3c..8d9af70 100644 --- a/mammoth/docx/numbering_xml.py +++ b/mammoth/docx/numbering_xml.py @@ -17,7 +17,12 @@ def _read_abstract_nums(element): def _read_abstract_num(element): abstract_num_id = element.attributes.get("w:abstractNumId") levels = _read_abstract_num_levels(element) - return abstract_num_id, levels + return abstract_num_id, _AbstractNum(levels=levels) + + +@cobble.data +class _AbstractNum(object): + levels = cobble.field() def _read_abstract_num_levels(element): @@ -65,4 +70,4 @@ class Numbering(object): return None else: abstract_num = self._abstract_nums[num.abstract_num_id] - return abstract_num.get(level) + return abstract_num.levels.get(level) -- cgit v1.2.3