Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@

Changelog
=========
* 0.3.6
* It is possible for a docx file to not contain a `numbering.xml` file but
still try to use lists. Now if this happens all lists get converted to
paragraphs.
* 0.3.5
* Not all docx files contain a `styles.xml` file. We are no longer assuming
they do.
* 0.3.4
* It is possible for `w:t` tags to have `text` set to `None`. This no longer causes an error when escaping that text.
* It is possible for `w:t` tags to have `text` set to `None`. This no
longer causes an error when escaping that text.
* 0.3.3
* In the event that `cElementTree` has a problem parsing the document, a
`MalformedDocxException` is raised instead of a `SyntaxError`
Expand Down
Binary file added pydocx/fixtures/missing_numbering.docx
Binary file not shown.
14 changes: 14 additions & 0 deletions pydocx/tests/test_docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,20 @@ def test_missing_style():
''')


def test_missing_numbering():
file_path = path.join(
path.abspath(path.dirname(__file__)),
'..',
'fixtures',
'missing_numbering.docx',
)
actual_html = convert(file_path)
assert_html_equal(actual_html, BASE_HTML % '''
<p>AAA</p>
<p>BBB</p>
''')


def _converter(*args, **kwargs):
# Having a converter that does nothing is the same as if abiword fails to
# convert.
Expand Down
4 changes: 3 additions & 1 deletion pydocx/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ def __init__(

def perform_pre_processing(self, root, *args, **kwargs):
self._add_parent(root)
self._set_list_attributes(root)
# If we don't have a numbering root there cannot be any lists.
if self.numbering_root is not None:
self._set_list_attributes(root)
self._set_table_attributes(root)
self._set_is_in_table(root)

Expand Down