Repository navigation
Commit 8495f90
authored
* feat: resolve moves and paragraph-property changes as revisions (ISSUES.md #68)
w:moveFrom, w:moveTo and w:pPrChange become first-class, id-addressable
revisions: list_revisions() lists them as move_from / move_to /
property_change rows, accept_revision / reject_revision resolve them, and
accept_all / reject_all, the author filter and the inferred changeset cover
them through the existing _resolve_all loop.
Per-element semantics mirror Word's revision pane. A move's four range marks
are scaffolding: never listed, never counted as unhandled, swept by
_sweep_move_range_marks once no pending move content lies between them.
Rejecting a w:pPrChange restores the recorded properties
(_restore_paragraph_properties), including a self-closing record and an
undefined style id. The accepted text-map view now excludes w:t inside
w:moveFrom, which Word writes for moved-away text.
Listing and the id index use one iter_revision_elements walk over
HANDLED_REVISION_TAGS instead of a getElementsByTagName per tag.
* test: fail the corpus save2 stage when resolvable revisions remain (ISSUES.md #68)
After accept_all the saved file may hold only UNHANDLED_REVISION_TAGS; any
ins/del/move/pPrChange element left behind fails save2 with
AssertResolvedTypesRemain. The reopen record carries the unhandled census,
the census marker keys on UNHANDLED_REVISION_TAGS, and the README census is
re-run with 0 unresolved elements.
* docs: document moves and pPrChange as listed revision types (ISSUES.md #68)
Revision.type's five values, per-type accept/reject semantics, the
two-rows-per-move rule and lone-half behaviour, and ResolveResult /
UnhandledRevision examples switched to types that are still unhandled.
* fix: seed the change-id counter from every revision mark's id (ISSUES.md #68)
The high-water mark folded only w:ins/w:del ids, while moves and
paragraph-property changes are now addressed by w:id in the same space. On
a document holding only a move, a new edit was allocated id 0 — the foreign
w:moveFrom marker's id — so both reported one group and reject_group on our
own edit removed the foreign move content instead. DocxXMLEditor now folds
every ALL_REVISION_TAGS id in one walk, at open and on fragment parse.
Also strips move paragraph-mark markers from a split paragraph's copied
w:pPr/w:rPr (a copied marker duplicated its id) and hoists comment markers
above w:moveFrom/w:moveTo wrappers as it does above w:ins/w:del, via one
_RUN_TRACK_CHANGE_TAGS constant.
* fix: report id-less handled marks and sweep range marks once per bulk call (ISSUES.md #68)
A w:moveFrom/w:moveTo/w:pPrChange with a missing or non-numeric w:id is
unreachable by id, so list_revisions() omits it — and since its tag left
UNHANDLED_REVISION_TAGS it vanished from list_unhandled_revisions() too,
letting accept_all() report a clean document with the mark (and a
moveFrom's hidden text) still in it. _unhandled_elements now also yields
handled-type marks with no adjudicable id, via one shared _adjudicable_id.
_resolve_all/_resolve_ids defer the move range-mark sweep to a single walk
at the end of the call instead of one per move half (quadratic in the
number of moves). _restore_deletion leaves a w:del nested inside the host
it restores untouched (its delText and rsidDel stay), for both w:del and
w:moveFrom hosts. The sweep treats id-less range marks and a Start whose
id a later Start reuses as unpaired. group_spans skips every paragraph-mark
marker, not only w:ins.
Docstrings for UnhandledRevisionWarning, get_visible_text,
get_original_text, list_unhandled_revisions and _insertion_text_nodes
describe the new contract; the harness save2 post-condition gets a unit
test.
* fix: sweep range marks after any resolution and tolerate non-numeric nested ids (ISSUES.md #68)
Move content can leave the document inside another resolved element — a
w:del wrapping a w:moveFrom, a w:ins wrapping a w:moveTo, a rejoined
paragraph whose mark carried a move marker — and the range marks around
it were then orphaned in neither listing. accept_revision/reject_revision
now sweep after every resolution (one deferred walk per bulk call).
_nearest_revision_ancestor_id and _descendant_revision_ids go through
_adjudicable_id, so a non-numeric w:id on a host or nested handled mark
no longer raises from list_revisions(); the mark is reported as unhandled.
The ISSUES.md #56/#62 walk-count pins gained count_revision_walks, a
counter for full-document iter_revision_elements traversals, so they pin
a real constant again now that the resolution path no longer uses
getElementsByTagName. An own edit made inside a foreign w:moveTo is
carried away when that move is rejected — documented as a known gap and
pinned with a strict xfail; docs no longer say list_unhandled_revisions()
lists exactly UNHANDLED_REVISION_TAGS.
* perf: skip the range-mark sweep on documents without move range marks (ISSUES.md #68)
DocxXMLEditor.holds_move_range_marks is set by the id-seeding walk when it
sees a MOVE_RANGE_TAGS element and cleared by the sweep once none remain,
so the sweep — a full-document walk — costs nothing on the move-free
document every accept_revision/accept_group used to pay it on.
Also: _restore_deletion keeps w:rsidDel on runs inside a nested w:moveFrom;
the corpus save2 post-condition is measured against accept_all's own
unhandled report rather than a static tag set, so a handled-type mark the
library reported as unreachable does not fail the file while an unreported
leftover (range marks included) still does; the README no longer claims
that accepting the drag-and-drop table move is exact (the source table
survives as empty cells); quickstart, SKILL.md and the accept_all docstring
describe the own-edit-inside-a-foreign-move gap, the moved-table residue and
a pPrChange carried away by a rejected split; _MARKUP_KIND_BY_TAG follows
its siblings' naming.
* fix: recompute the range-mark flag when a snapshot is restored (ISSUES.md #68)
A rolled-back batch replaces the DOM wholesale; holds_move_range_marks now
follows it (one walk on the rollback path only). Pins the corpus save2
rule that range marks may stay while their move is reported as unhandled.
1 parent 00e01e2 commit 8495f90
17 files changed
Lines changed: 2259 additions & 641 deletions
File tree
- benchmarks/corpus
- docs
- docx_editor
- skills/docx
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
| |||
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
133 | | - | |
| 137 | + | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
| |||
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
147 | | - | |
| 151 | + | |
148 | 152 | | |
149 | | - | |
| 153 | + | |
150 | 154 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
154 | 159 | | |
155 | 160 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
169 | 196 | | |
170 | 197 | | |
171 | 198 | | |
172 | | - | |
| 199 | + | |
173 | 200 | | |
174 | 201 | | |
175 | 202 | | |
| |||
179 | 206 | | |
180 | 207 | | |
181 | 208 | | |
182 | | - | |
183 | | - | |
| 209 | + | |
| 210 | + | |
184 | 211 | | |
185 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
186 | 215 | | |
187 | 216 | | |
188 | 217 | | |
| |||
204 | 233 | | |
205 | 234 | | |
206 | 235 | | |
207 | | - | |
208 | | - | |
| 236 | + | |
| 237 | + | |
209 | 238 | | |
210 | 239 | | |
211 | 240 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
217 | 245 | | |
218 | 246 | | |
219 | 247 | | |
220 | 248 | | |
221 | | - | |
| 249 | + | |
222 | 250 | | |
223 | | - | |
| 251 | + | |
224 | 252 | | |
225 | 253 | | |
226 | 254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
40 | | - | |
41 | | - | |
| 44 | + | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
52 | | - | |
53 | | - | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | 59 | | |
56 | 60 | | |
| |||
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
196 | | - | |
| 200 | + | |
197 | 201 | | |
198 | 202 | | |
199 | 203 | | |
| |||
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
233 | | - | |
| 237 | + | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
237 | 241 | | |
238 | 242 | | |
239 | 243 | | |
240 | | - | |
| 244 | + | |
241 | 245 | | |
242 | 246 | | |
243 | 247 | | |
| |||
658 | 662 | | |
659 | 663 | | |
660 | 664 | | |
661 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
662 | 670 | | |
663 | 671 | | |
664 | 672 | | |
665 | 673 | | |
666 | 674 | | |
667 | | - | |
| 675 | + | |
| 676 | + | |
668 | 677 | | |
| 678 | + | |
| 679 | + | |
669 | 680 | | |
670 | 681 | | |
671 | | - | |
672 | | - | |
673 | | - | |
| 682 | + | |
674 | 683 | | |
675 | 684 | | |
676 | 685 | | |
677 | 686 | | |
678 | 687 | | |
679 | 688 | | |
680 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
681 | 718 | | |
682 | 719 | | |
683 | 720 | | |
| |||
717 | 754 | | |
718 | 755 | | |
719 | 756 | | |
720 | | - | |
721 | | - | |
| 757 | + | |
| 758 | + | |
722 | 759 | | |
723 | 760 | | |
724 | 761 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
366 | | - | |
367 | | - | |
| 366 | + | |
368 | 367 | | |
369 | 368 | | |
370 | 369 | | |
| |||
0 commit comments