Skip to content

Commit d622225

Browse files
author
Steve Canny
committed
oxml: convert CT_Numbering to xmlchemy
1 parent 1e9c244 commit d622225

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

‎docx/oxml/parts/numbering.py‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66

77
from .. import OxmlElement
8-
from ..ns import qn
98
from ..shared import CT_DecimalNumber
109
from ..simpletypes import ST_DecimalNumber
1110
from ..xmlchemy import (
@@ -95,22 +94,17 @@ class CT_Numbering(BaseOxmlElement):
9594
``<w:numbering>`` element, the root element of a numbering part, i.e.
9695
numbering.xml
9796
"""
97+
num = ZeroOrMore('w:num', successors=('w:numIdMacAtCleanup',))
98+
9899
def add_num(self, abstractNum_id):
99100
"""
100-
Return a newly added CT_Num (<w:num>) element that references
101-
the abstract numbering definition having id *abstractNum_id*.
101+
Return a newly added CT_Num (<w:num>) element referencing the
102+
abstract numbering definition identified by *abstractNum_id*.
102103
"""
103104
next_num_id = self._next_numId
104105
num = CT_Num.new(next_num_id, abstractNum_id)
105106
return self._insert_num(num)
106107

107-
@property
108-
def num_lst(self):
109-
"""
110-
List of <w:num> child elements.
111-
"""
112-
return self.findall(qn('w:num'))
113-
114108
def num_having_numId(self, numId):
115109
"""
116110
Return the ``<w:num>`` child element having ``numId`` attribute
@@ -122,9 +116,6 @@ def num_having_numId(self, numId):
122116
except IndexError:
123117
raise KeyError('no <w:num> element with numId %d' % numId)
124118

125-
def _insert_num(self, num):
126-
return self.insert_element_before(num, 'w:numIdMacAtCleanup')
127-
128119
@property
129120
def _next_numId(self):
130121
"""

0 commit comments

Comments
 (0)