From d091e47adf6cd69d986cac935de9d61b7da17f82 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 13 Dec 2013 17:35:08 +0000 Subject: Move NumberingLevel to documents module --- mammoth/documents.py | 6 ++++++ mammoth/docx/numbering_xml.py | 9 +++------ tests/docx/document_xml_tests.py | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mammoth/documents.py b/mammoth/documents.py index 6ce4582..7fb34b6 100644 --- a/mammoth/documents.py +++ b/mammoth/documents.py @@ -35,3 +35,9 @@ def tab(): image = Image hyperlink = Hyperlink + + +class NumberingLevel(object): + def __init__(self, level_index, is_ordered): + self.level_index = level_index + self.is_ordered = is_ordered diff --git a/mammoth/docx/numbering_xml.py b/mammoth/docx/numbering_xml.py index 77400c1..115d812 100644 --- a/mammoth/docx/numbering_xml.py +++ b/mammoth/docx/numbering_xml.py @@ -1,3 +1,6 @@ +from ..documents import NumberingLevel + + def read_numbering_xml_element(element): abstract_nums = _read_abstract_nums(element) nums = _read_nums(element, abstract_nums) @@ -54,9 +57,3 @@ class Numbering(object): return None else: return num[level] - - -class NumberingLevel(object): - def __init__(self, level_index, is_ordered): - self.level_index = level_index - self.is_ordered = is_ordered diff --git a/tests/docx/document_xml_tests.py b/tests/docx/document_xml_tests.py index 30580d0..e6e8c88 100644 --- a/tests/docx/document_xml_tests.py +++ b/tests/docx/document_xml_tests.py @@ -6,7 +6,7 @@ import funk from mammoth import documents, results from mammoth.docx.xmlparser import element as xml_element, text as xml_text from mammoth.docx.document_xml import read_document_xml_element -from mammoth.docx.numbering_xml import Numbering, NumberingLevel +from mammoth.docx.numbering_xml import Numbering from mammoth.docx.relationships_xml import Relationships, Relationship @@ -68,7 +68,7 @@ class ReadXmlElementTests(object): properties_xml = xml_element("w:pPr", {}, [numbering_properties_xml]) paragraph_xml = xml_element("w:p", {}, [properties_xml]) - numbering = Numbering({"42": {"1": NumberingLevel("1", True)}}) + numbering = Numbering({"42": {"1": documents.NumberingLevel("1", True)}}) paragraph = _read_and_get_document_xml_element(paragraph_xml, numbering=numbering) assert_equal("1", paragraph.numbering.level_index) -- cgit v1.2.3