Skip to content
Open
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
9 changes: 4 additions & 5 deletions unstructured/partition/docx.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,10 @@ def iter_document_elements(cls, opts: DocxPartitionerOptions) -> Iterator[Elemen
# Microsoft Teams chat transcript exported to DOCX contains no sections. Such a
# "section-less" document has to be interated differently and has no headers or footers and
# therefore no page-size or margins.
return (
self._iter_document_elements()
if self._document_contains_sections
else self._iter_sectionless_document_elements()
)
if self._document_contains_sections:
yield from self._iter_document_elements()
else:
yield from self._iter_sectionless_document_elements()

def _iter_document_elements(self) -> Iterator[Element]:
"""Generate each document-element in (docx) `document` in document order."""
Expand Down