Add independent list instances and continuation paragraphs - #1614
Draft
pseudosavant wants to merge 3 commits into
Draft
pseudosavant wants to merge 3 commits into
pseudosavant wants to merge 3 commits into
Conversation
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.
Problem
Paragraph styles alone do not give document generators control over list identity, starting numbers, or unnumbered continuation paragraphs. This adds a draft public API for those operations using numbering already present in a document or template.
API
Document.add_list(style="List Number", start=1, level=None)creates an independent sequence.ListInstance.apply(paragraph, level=None)numbers a paragraph without changing its style.restart(start=1, level=None)returns an independent sequence.apply_continuation(paragraph, level=None)suppresses numbering and preserves text alignment.levelsanddefault_levelexpose template level selection.A caller resumes a sequence by applying the same handle again. Separate abstract definitions preserve independent counters when sequences are interleaved. In Word, sharing an abstract definition caused a 3, 4, 1, 5 sequence to display 3, 4, 1, 2. The implementation copies the original definition and instance overrides without changing template definitions.
This intentionally starts with template-backed list authoring in the main story and table cells. It does not add arbitrary numbering-format authoring or numbering-style-link resolution. Undefined levels, invalid starts, and cross-document use are rejected before mutation. Continuation formatting is a snapshot. Word has no list-item container.
Validation
Design discussion
Related work includes #210 and #582. This draft focuses on a small public authoring API rather than a general numbering editor. API names, supported scope, and XML helper boundaries are open for review. My current downstream consumer is markdown-docx, and I can adapt it to upstream conventions.
This branch contains isolated feature commits based directly on upstream master. It has no fork packaging, version changes, or dependency on the fork's other features.