Skip to content
Merged
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
15 changes: 9 additions & 6 deletions dedoc/readers/docx_reader/numbering_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def __get_list_item_text(self, ilvl: str, num_id: str) -> str:
if abstract_num_id in self.state.prev_ilvl_dict:
prev_ilvl = self.state.prev_ilvl_dict[abstract_num_id]

restarted = False
# startOverride:
if lvl_info.restart:
if abstract_num_id in self.state.prev_num_id_dict:
Expand All @@ -112,13 +113,15 @@ def __get_list_item_text(self, ilvl: str, num_id: str) -> str:
prev_num_id = None
if prev_num_id and prev_num_id != num_id:
self.state.numerations_dict[(abstract_num_id, ilvl)] = lvl_info.start
restarted = True

# it's a new deeper level
if prev_ilvl < ilvl and lvl_info.lvl_restart or (abstract_num_id, ilvl) not in self.state.numerations_dict:
self.state.numerations_dict[(abstract_num_id, ilvl)] = lvl_info.start
# it's a continue of the old level (current level <= previous level)
else:
self.state.numerations_dict[(abstract_num_id, ilvl)] += 1
if not restarted:
# it's a new deeper level
if prev_ilvl < ilvl and lvl_info.lvl_restart or (abstract_num_id, ilvl) not in self.state.numerations_dict:
self.state.numerations_dict[(abstract_num_id, ilvl)] = lvl_info.start
# it's a continue of the old level (current level <= previous level)
else:
self.state.numerations_dict[(abstract_num_id, ilvl)] += 1

# there isn't the information about this list
else:
Expand Down