fix(odt): restart a continued sublist when its parent item advances
Fixes part 1 of #203 (nested ODT list numbering). Part 2 (annotations inlined into text) is covered by #206.
Problem
Word saves a nested list as ODT with text:continue-numbering="true" on every text:list. parse_list keeps one continuation counter per (style, depth). Item 2's sublist therefore resumed after item 1's sublist: 2.1. Payment rendered as 2.3. Payment. In ODF, LibreOffice and Word, a level restarts when a higher level advances.
Change
When an item at depth d takes a number, the continuation counters of the same list style at depths below d are cleared. A sublist under the new item then starts at its own start value. Continuation still works between sibling sublists inside one item and between top-level lists.
Verification
- New test
continued_sublist_restarts_when_its_parent_advancesinformats/odf/mod.rsuses the reproduction from #203. It fails on main (2.3. Payment) and passes with the change. cargo test: all suites pass (lib 287 passed).rustfmt --checkon the changed files: clean.cargo clippy --all-targets -- -D warnings: my local toolchain (1.98) reports 7collapsible_iferrors inrtf/tables.rsandsheet/numfmt.rs. Main reports the same errors here, and none are in the changed files.
🤖 Generated with Claude Code
Summary by cubic
Fixes part 1 of #203: a continued sublist under an item now restarts numbering when its parent item advances, matching ODF and LibreOffice behavior. Previously, text:continue-numbering on every level made item 2's sublist carry over item 1's sublist counter, so its first child read 2.3 instead of 2.1.
- Clears the continuation counters at depths below a newly numbered item across every list style, since a sublist may name its own style; continuation still works between sibling sublists and top-level lists.
- Adds a regression test using the reproduction from #203, including a case where the sublist names its own style; it fails on
mainand passes with the change.