Fix and speed up complex Word numbering resolution - #137
Open
JasonRJFleischer wants to merge 6 commits into
Open
Fix and speed up complex Word numbering resolution#137JasonRJFleischer wants to merge 6 commits into
JasonRJFleischer wants to merge 6 commits into
Conversation
Compute each %N in multi-component lvlText from the matching level's counter and start value instead of splicing the previous paragraph's rendered label. This matches Word's parent-level numbering behavior and avoids crashes when the prior paragraph uses a different list format.
Do not apply a preceding list's startOverride when the current list has its own explicit start. This keeps independent list instances separate while preserving continuation across re-keyed section lists.
Cache abstractNum and startOverride lookups on CT_Numbering, invalidating on add_num, to avoid repeated numbering XML scans during paragraph numbering.
Cache resolved paragraph numbering properties and styles during get_num_for_p, invalidating when numbering assignments change. This removes repeated pPr/style resolution while preserving existing skip behavior.
Use cached paragraph style and startOverride lookups inside value_at_ilvl so multi-component lvlText rendering stays on the same fast path as single-level numbering.
JasonRJFleischer
force-pushed
the
jason/num-order-fixes
branch
from
July 29, 2026 19:21
e26bc5d to
9754571
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (e.g. "Related to ...", "Closes ...", etc.)
Mostly LLM Generated
Fixes correctness issues in Word numbering resolution and speeds up large-document numbering reads.
lvlTextlabels from per-level numbering state instead of parsing the previous rendered label.startOverridevalues from affecting independent counters.0.8.10.41.See tests in Platform: https://github.com/openlawlibrary/platform/pull/6224
Code review checklist
core/tests/test_python-docxare updated and passing