mirror of
https://github.com/storytold/wordcraft.git
synced 2026-12-02 02:37:26 -06:00
9af6bdea33fa88ebf656bd100e2ddfa2b8bc2cc9
458
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
878f3ef2ca |
Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts: # ROADMAP.md |
||
|
|
25f34eec75 | Merge branch 'main' into fix/pdf-figure-object-lookups | ||
|
|
36e7ee7ade |
#6851: tracked changes are dated in local time, as Word reads w:date (#6876)
* #6851: date tracked changes in local time, as Word reads w:date Word writes w:date as the local wall-clock time with a Z it doesn't mean, and reads it back the same way. WordCraft stamped new tracked changes with UTC, so Word showed them shifted by the author's offset from UTC. Typing, deletions, moves, formatting changes and Compare's result now take cmd::revision_date(): the local time from the existing local_offset_secs helper, written with a Z. Comments keep their w16cex:dateUtc and are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #6851: the local-time test accepts any second between its samples Review on #6876: the tracked change may be stamped a second after the first sample and before the second, so compare against the interval, in order, rather than its two ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #6851: check the stamp against each second's own local time Review on #6876: across a backward daylight-saving change the local times of the two samples no longer bound the stamp. Sample the UTC clock instead and accept the local time of any second between the samples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #6851: the local-time test pins its zone and covers every revision A test-only, per-thread zone for revision_date() lets tracked_changes_carry_the_local_time stamp at UTC+8:45 on any runner. On CI's UTC runner a UTC stamp was also the local one, so switching a call site back to now_iso() passed. The test now makes a revision through each place that dates one: typing, a paragraph tool, formatting, AutoFormat's border line, a tracked cut pasted as a move, and Compare. * #6851: keep tracked change dates in UTC; convert w:date at the DOCX boundary The document keeps the UTC instant, so revision grouping tells apart two edits an hour apart in the repeated hour as daylight saving time ends. Saving .docx/.docm/.dotx/.dotm or Word XML writes w:date as local wall-clock time with a Z, as Word writes and reads it; opening them reads it back to UTC. Tests set the clock and zone per thread. * Dependencies: take craft-libs main at 8a5b916541 8a5b916541 is craft-libs#3220: craft-docx reads and writes w16du:dateUtc on tracked changes and keeps it in the shared model's Revision, so two changes with one local w:date stay two. #6876 (#6851) builds on it. The egui and winit forks craft-libs builds with are unchanged (b9770908e0, a517b3846e). Cargo.lock: the craft-libs sources move to the new rev and craft-control-protocol, a craft-libs crate, is added. * #6851: tracked changes keep their UTC time beside w:date A revision now has date_utc, as comments do, read from and written to w16du:dateUtc by craft-docx. Changes made here are stamped with both in UTC, grouped by the UTC instant, and a Word save writes their w:date in local wall-clock time, as Word does, with dateUtc beside it. A change read from a file is written as read: open no longer guesses the zone a w:date without dateUtc was written in. review.changes reports the UTC time when it is known. Two edits in the repeated hour reopen as two changes, and Reject on the second leaves the first pending. * Dependencies: section metadata test expects w16du in mc:Ignorable craft-libs#3220 declares the w16du namespace in body parts and lists it in mc:Ignorable, so readers that don't know it ignore it. * #6851: rustfmt the test revisions * #6851: docs describe dateUtc and dates written as read * #6851: date a change in local time when it is made, not when it is saved The save treated a revision whose w:date equals its dateUtc as made here and moved its w:date to local time. A file written in UTC has the two equal too, so saving it in another zone moved the time Word shows for an edit nobody touched. A change made here now gets its local w:date when it is made (cmd::made_revision), with its UTC time in date_utc, and saves write every revision as it is. Nothing is inferred from the dates. * #6851: OpenDocument dates a tracked change by its UTC time A change made here keeps Word's local wall-clock time in `date`, which the ODF writer wrote verbatim as dc:date, an instant, so an edit at 08:33 UTC at UTC+8 was exported as 16:33 UTC. The ODT, OTT and Flat ODF exports now date a change by its UTC time where it is known, and by `date` otherwise. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <98639962+benandez@users.noreply.github.com> |
||
|
|
0c72c0a013 | #3614: integrate current PDF tag order with figure lookups | ||
|
|
b0a5ff0469 | Merge origin/main into fix/mailings-csv-limits | ||
|
|
e802ec8f28 | Merge origin/main into fix/pdf-figure-object-lookups | ||
|
|
b7819874c8 | #6767: file-format parity names the ends that can't move their full inset | ||
|
|
9cf6a33374 |
Merge remote-tracking branch 'origin/main' into fix/6767-arrow-stroke-inside-head
# Conflicts: # docs/file-format-parity.md |
||
|
|
5e129ac951 |
Validate: add wordcraft validate, a structural integrity checker for .docx (#5875)
* Validate: add wordcraft-validate, a structural integrity checker for .docx (#5848) * Validate: harden verdict integrity against unavailable package content Follow-up to the CodeRabbit review round. The contract throughout: a check that could not run must not report as though it did, and content that could not be read must not be treated as absent. - Unreadable zip entries keep their identity (from the zip reader's own metadata) and are marked content-unavailable; every absence- dependent error is suppressed while any part's identity or content is unknown, and the run reports INCOMPLETE instead of a FAIL manufactured from missing data. - The same guard now covers the typed-relationship, image-reference, custom-XML schema, comment/note-reference and numbering checks, in both owner scopes. - Scan finalisation splits prefix-established findings (always reported) from completion-dependent ones (gated on a complete scan); duplicate checking marks INCOMPLETE when the entries budget leaves raw directory records unexamined, and when the central directory cannot be parsed at all. - CLI: surplus operands are a usage error before any file is validated; non-Unicode paths validate normally; report output escaping audited. - Corpus generators fixed (vMerge/gridSpan, commentsExtended paraId, pinned zip timestamps, fixture 23 isolation); corpus and calibration fixtures regenerated. Seventeen new tests, each mutation-checked. One residual recorded in the PR discussion: a readable-but-unparseable commentsExtended part can still draw unsupported COMMENTEX-LINK warnings (Warning severity only; cannot change a verdict). * Validate: add docstrings across validator and corpus functions (#5875) * Validate: document the budget tests; correct a coverage note's identifier name The budget-exhaustion tests in the lib.rs test module were the remaining undocumented functions of any complexity on the branch. Each now carries a docstring stating the contract it pins. Also corrects the read_comments_ids budget note: the values it records are w16cid:paraId values, so the note now says 'later paraIds were not recorded' instead of 'durableIds'. * Validate PR 2 step 0: content-model tables and generated model.rs Add the ECMA-376 content-model tables the grammar checks will read, and the deterministic chain that produces them: - crates/validate/model/: the v2 (namespace-qualified) extractor, the WML and DrawingML tables for Strict and Transitional, generate_model.py (JSON -> Rust), and a README with the regeneration chain, archive URLs and SHA-256s, the generator's failure conditions and scope limits. - crates/validate/src/model.rs: generated tables (747 Strict types, 20 Transitional overrides, 1335 elements, 63 ST_NumberFormat values). It is not read by any check yet (dead_code allowed until the first rule). - crates/validate/src/model_tests.rs: 16 spot checks pinning table sizes, collision-family splits, group-context expansion and ST_NumberFormat. - ATTRIBUTION.md rows for the four tables and model.rs. WML Strict regenerates byte-identical to content_model_v2.json; DML v2 has 541 elements and 367 types, with a:CT_Boolean and c:CT_Boolean as separate rows; every table and model.rs regenerate byte-identically. Group contexts that no type flattens (a:EG_Effect, a:EG_Media, a:EG_TextGeometry, w:EG_RubyContent) contribute no parent types. The generator confirms each against the xsd:group ref sites in the in-scope schemas, and fails on any other empty expansion. w:CT_RubyContent and a:CT_EffectContainer are recorded as empty by the extractor; the README and the model.rs header say checks must treat them as unmodelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * PR2 Step4: detect table cells without a terminal paragraph * Validate PR 3: MATH-PLACEMENT — math elements where Word refuses them MS-OI29500 Part 1 §22.1.2.77 notes (b), (d), (e), (f) and §22.1.2.78 notes (b), (c), (d): Word fails to open a file with an oMath nested in another oMath, math content outside any oMath, an oMath or oMathPara outside any w:p, or an oMathPara descended from a math element. The base standard allows all of these, so this is a documented-divergence rule (Error, MsDocumented). A stray math island is reported once, at its root element. Story parts only, matching the documented scope. * Validate PR 3: COMMENT-RANGE-COUNT and PROTECTION-PASSWORD COMMENT-RANGE-COUNT (MS-OI29500 Part 1 §17.13.4.4 note (a)): Word will not open a file with more than 32767 comment ranges. Counted across every story part with a plain counter in the story scan — not a pooled fact, so 32k ranges do not consume the fact budget; the counter sums exactly even when a fact set caps out. PROTECTION-PASSWORD (MS-OI29500 Part 1 §17.15.1.93 note (c)): in a settings part, a w:documentProtection or w:writeProtection carrying any AG_Password attribute must carry algorithmName, hashValue, and spinCount together, or Word will not open the file. Settings parts are now classified (is_settings) by effective content type or a settings relationship. * Validate PR 3: CONTENTPART-TYPE — a contentPart target that is not text/xml MS-OI29500 Part 1 §17.3.3.2 note (a): Word will fail to load the document if the content part's content type is not text/xml. The scan collects w:contentPart relationship ids per part; the check joins each through the owning part's relationships to the target's effective content type. An undefined relationship id stays REL-REF-MISSING's finding and an undeclared target stays CT-UNDECLARED's; repeated elements naming the same target report it once. * Validate PR 3: compat-mode count limits — BOOKMARK-COUNT, PERM-COUNT, MOVE-RANGE-COUNT With w:uiCompat97to2003 set in settings, Word fails to open a file with more than 16,380 bookmarks (MS-OI29500 §17.13.6 (b)), 32,752 range permissions (§17.13.7.1 (b), §17.13.7.2 (d)), or 32,751 moveFrom/moveTo ranges (§17.13.5.24 (a), counted by start markers, from and to together). Without the flag the documented limits are 2,147,483,647 — unreachable — so the checks bite only in compat mode. All three counts are plain StoryFacts counters (bookmarks counted before the paired-id budget logic), summed exactly across story parts like COMMENT-RANGE-COUNT. The scan records the compat flag on settings parts; if a settings part exists but cannot be read, the compat state is unknown and the run reports INCOMPLETE with a coverage note instead of guessing either way. * Validate: count raw name bytes in central-directory duplicate detection (#5895) Count duplicate entry names on raw bytes during central-directory parsing rather than decoded strings, preventing distinct legacy-encoded entry names from falsely colliding as replacement-character duplicates. Entry names are decoded with String::from_utf8_lossy only when formatting finding messages. Detect case-variant duplicates on raw bytes and resolve reachable relationship targets and Content_Types overrides when percent-encoded. (From reubgr/wordcraft#2, by batistalucasv.) * Validate: scope the #5895 landing to the issue as filed The preceding commit lands reubgr/wordcraft#2 in full in the history; this adjustment brings the shipped tree back to what #5895 covers: - Removed: percent-decoded equivalence in entry lookup, reachability, and content-type resolution. Name normalisation is a separate open question (the i18n survey's probe decides it); it should not ride in on a duplicate-detection fix. - Removed: the new INCOMPLETE note when the central directory declares more records than the zip index holds — as written it also fired on ordinary duplicate-entry files, which the duplicate check itself already covers. - Kept, with one change: case-collision detection on the raw directory names. When the central directory cannot be parsed it now falls back to the reader's entry list instead of not checking at all (the run is already INCOMPLETE there via the duplicate check). * Validate PR 3: NOTE-PR-LISTING and NOTE-PR-DANGLING — the footnotePr join ECMA-376 Part 1 §17.11.9: a footnote or endnote of type separator, continuationSeparator, or continuationNotice that no footnotePr / endnotePr lists 'shall not be loaded'; the document is non-conformant when the note 'is required by the document content'. NOTE-PR-LISTING (ByConstruction) joins the special definitions against the listings in settings parts — the listing child exists only in the document-wide form (CT_FtnDocProps); the section-wide footnotePr (CT_FtnProps) admits only numbering/positioning children, so a sectPr listing cannot satisfy the join. Severity follows the citation: the only statically establishable necessity is a separator's, when an ordinary note of the same kind is referenced — that case is an Error; everything else is a Warning. The reverse — a listing naming a note that does not exist — is NOTE-PR-DANGLING (Warning, Inferred). Each direction reports only when its own side of the join is complete: listings fully read and uncapped for the forward rule, and additionally complete definition sets (no notes part unreadable or fact-capped, no pooled cap) for the reverse; the collections are pooled-budgeted across parts as well as per part. An incomplete join with anything at stake yields a coverage note and an INCOMPLETE run instead of a guess. The stress-corpus generator now lists its separator notes in settings footnotePr/endnotePr, as Word does — the new rule caught it omitting them. Corpus regenerated; manifest hashes updated. (Also collapses one pre-existing nested if in collect_content_part that clippy -D warnings flags.) * Validate PR 3: HEADERSOURCE-PRESENT — w:headerSource in mail merge settings MS-OI29500 Part 1 §17.14.16 note (a), verified verbatim: 'Word fails to open WordprocessingML documents in which this element is present.' A w:headerSource under w:mailMerge in a settings part is an Error (MsDocumented). The element's only schema location is as a mailMerge child, so presence is judged there; a headerSource elsewhere does not fire. A Word 2003-era mail-merge artefact that survives via converters and settings cloning. * Validate: bound CONTENTPART-TYPE collection and index its lookups Two findings from the C3 increment's review round that the fix round missed (the delta review scoped only a separate question): the contentPart id collection ignored the fact budget — per part and pooled — and the check deduped ids and resolved relationships with linear scans, quadratic in the number of references. Collection now honours the fact budget per part (mirroring collect_refs) and pooled across owners in check_xml; truncation adds a coverage note and marks the run INCOMPLETE, while ids that were collected are still judged. Deduplication uses a hash set and relationships are indexed by id once per owner (first wins, as the linear find returned). Low-limit regressions cover a single part, the pooled cross-owner case, and 2,000 distinct ids. * Validate: enforce pooled budgets while appending, not after The C8 delta review's remaining P2: the note collections (and, since its hardening commit, the contentPart ids) were pooled- budgeted by extending first and truncating after the scan loop, so accumulation could reach the per-part cap times the part count before the bound applied, and truncate does not release capacity. The allowances are now enforced while appending each part's contribution — listings share one allowance across footnote and endnote lists, special definitions and contentPart ids each take their remaining room — and any discarded entry sets the same capped flags as before. Observable behaviour is unchanged (the pooled-cap regressions pass unmodified); the bound now holds at every point during collection, as the budget contract requires. * Validate: pin the capped CONTENTPART-TYPE verdicts From the hardening delta review: with collection capped, collected references that are valid must yield INCOMPLETE (not PASS — not every reference was checked), and collected references that are defective keep FAIL precedence over the incomplete marking, alongside the coverage note. Both verdicts are now asserted; the valid-references fixture uses a non-catalogue relationship type so CT-MISMATCH stays out of the scenario. * Validate: reconcile PR 3 grades with the batch-b6 oracle results Calibration batch b6 ran one Word-for-the-web fixture per PR 3 rule (19 files; the first run was invalidated by a fixture-builder defect, the rebuilt batch's control opens clean). Outcomes: Confirmed at the corruption banner, evidence upgraded to Observed: CONTENTPART-TYPE (image target banners, text/xml twin clean) and HEADERSOURCE-PRESENT. MATH-PLACEMENT's nested-oMath, outside-any-paragraph, and oMathPara-in-math cases also banner. Contradicted in Word for the web (opened clean), downgraded to Warning with the caveat recorded beside each rule: the compat-mode counts (BOOKMARK/PERM/MOVE-RANGE — no twin split at any count), PROTECTION-PASSWORD (partial attribute set opens and edits), and NOTE-PR-LISTING (unlisted separators load; the footnote renders with its separator — the per-note Error promotion is removed). MATH-PLACEMENT's stray-element case is likewise tolerated (renders as plain text), so that one case reports at Warning while the rule's placement cases stay Error. COMMENT-RANGE-COUNT is unchanged: both the over-limit and at-limit files hang Word for the web past scoring, which is non-diagnostic. Tests pin the new severities and the Observed grades. * Validate PR 3: COMMENT-RANGE-UNPAIRED — a lone comment range start or end MS-OI29500 Part 1 §17.13.4.4 notes (b)-(c) and §17.13.4.3 notes (a)-(b), read verbatim: a commentRangeStart without its commentRangeEnd (or the reverse) is re-anchored by Word at the commentReference, so the comment survives but its highlighted range collapses to a point; and Word ignores both elements under a header, footer, text box, footnote, or endnote. Warning / MsDocumented. Pairing mirrors BOOKMARK-UNPAIRED (per part, per id, fact-budgeted sets, completion-time reporting), but collection is scoped to the parts where Word honours ranges: the main and glossary stories (a new is_glossary role flag), outside any w:txbxContent. COMMENT-RANGE-COUNT's document-wide counter is unchanged. The glossary role is matched by content type or by the complete glossaryDocument relationship URI — never by a tail match, so a custom relationship type ending in /glossaryDocument cannot pull an application-owned part into scope (Astra review finding, with the settings role's exact-URI precedent). * Validate PR 3: the paraId family — PARAID-DUP and PARAID-VALUE MS-DOCX v20260818 §2.6.2.3 and §2.6.2.4, read verbatim before implementing. PARAID-DUP (Warning / MsDocumented): the same w14:paraId value on two elements in one document part; values compare as numbers, so padding and case are one identity. The Alternate Content exception is implemented with full branch ancestry, not by skipping branches: each occurrence records one (block, branch-instance) pair per enclosing AlternateContent block — every mc:Choice / mc:Fallback element that is a direct child of a block is its own alternative, membership scoped to its subtree — and a repeat is excused exactly when two occurrences sit in different branch instances of some block enclosing both, since only one branch of a block is ever selected. PARAID-VALUE applies inside branches too. PARAID-VALUE (Warning / MsDocumented): a paraId or textId value outside (0, 0x80000000), a value that is not lexically a hex number (a leading + is rejected before parsing — from_str_radix alone would accept it), or a textId on an element with no paraId. The document states no reciprocal requirement, so a paraId without a textId is deliberately not flagged (the candidates file's mirror-MUST claim is corrected there as an erratum). Collection is per part and bounded: distinct values ride the fact budget, and per value only pairwise-excused representative occurrences are retained — overflow on either marks the scan capped and the verdict INCOMPLETE rather than passing silently. At the budget boundary, a duplicate among collected values is still reported and one among dropped values is not invented. * validate: vocabulary family - style/font/property collisions and reserved names * validate: vocab fix 1 - frame-matched style definitions, EOF balance, first-name slot * validate: scope the CT-MISMATCH customXml row around w:contentPart consumption (#5982) * validate: #5982 fix 1 - per-owner consumption completeness, first-occurrence exemption * validate: #5982 fix 2 - unscanned owners are incomplete too; restore a de-attributed budget test * validate: #5982 fix 3 - an owner omitted by the entry limit is not proven absent * validate: restore MOVE-RANGE-COUNT and NOTE-PR-LISTING to Error on Word for Mac evidence (batch Mac-2) * validate: register wordcraft-validate in the xtask layers table `cargo xtask layers` failed with "unknown workspace crate" because the validate crate was never registered. It has no workspace dependencies, so it is Standalone, like control-key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * validate: accept the full main-part content-type family (.dotx/.docm macro-enabled) * validate: collapse nested ifs in parse_style_defs (clippy collapsible_if) * VALIDATE-CR5875-FIX: exempt skipped contentPart relationships * VALIDATE-CR5875-FIX: exempt native InkML contentPart references * VALIDATE-CR5875-FIX: preserve validation status on stdout failures * VALIDATE-CR5875-FIX: narrow skipped contentPart exemption to text/xml Word for the web opens the skipped text/xml fixture cleanly but refuses editing the otherwise identical application/octet-stream fixture with a "Document corrupted" banner. Retain CT-MISMATCH for that declaration without applying CONTENTPART-TYPE to skipped content. Filter skipped w:contentPart references before pooling exemptions. Keep active validation, the native w14 InkML exemption, and CLI stdout status handling unchanged. Cover both element forms and wrong-type controls. * #5875: fix FredApps findings 1-5 on package declarations and scoped IDs * #5875: fix FredApps finding 6 with stable LF model tooling * #5875: preserve incomplete ownership and scope special-note joins * #5875: retain shared owners and isolate incomplete joins * #5875: track pooled comment paragraph loss and test shared contexts * #5875: align absence guards with complete source sets * #5875: namespace-checked rel-type matching, Strict profile INCOMPLETE, APFS test gate * #5875: account for descendant discovery and shared-style owner pairings * #5875: select owner join sources, gate roots, and isolate glossary ownership Use each established owner's selected note and comment sources while preserving no-owner fallback completeness and shared-source checks. Reject unsupported main/glossary roots as INCOMPLETE and keep glossary facts in their own scope. Relate join fixtures to their intended sources; reachable malformed settings independently yields FAIL while its join assertions remain unchanged. Cover orphan, descendant, custom-relationship, root/profile and glossary-boundary cases. * #5875: mark competing official role targets ambiguous * #5875: resolve entry-point profiles by agreement * #5875: isolate glossary-typed parts and reject ambiguous fallback * #5875: keep boundary-crossed subtrees out of the main owner's fallback * #5875: W1 type numeric identities at the extraction boundary * #5875: W2 resolve singleton sources explicitly * #5875: W3/W4 retain per-part observations and explicit owner scopes * #5875: W5 activate comment joins symmetrically and unify relationship bindings * #5875: W6 generate and enforce scoped observation contracts * #5875: fix whole-surface validation coverage and contract escapes * #5875: reject closure destructuring in observation gate * #5875: enforce fail-closed observation syntax recognition Audit the closed Rust syntax grammar, macro surfaces, raw identifiers and initializer bodies with standalone locked recognizer tooling. Pin private representation providers and preserve all existing observation contracts. Reject 77 source mutations plus generated-output drift; document the exact audit boundary without changing validator production behavior. Owner Reuben approved Unicode-3.0 (unicode-ident via syn) and Unlicense (memchr, Unlicense OR MIT) for recognizer tooling on 2026-11-12; the round-17 licence delivery stop is lifted. Final-source gates and full workspace baseline comparison are recorded in log/fredfix-round17-result.md. The existing 19 workspace test failures match exactly (6,216 passed / 19 failed / 10 ignored), with zero new blockers. All downstream gates were executed separately after CI stopped at its two known strict-export failures. * #5875 R18: record lookup truth tables and enforcement census * #5875 R18 R1-R2: carry package absence evidence and audit its consumers * #5875 R18 R3: normalize observation accessors and retained membership flow * #5875 R18 R4-R5: seal reader identities and standard macro grammar * #5875 R18 R1-R2: close Resolution view and return-alias interfaces * #5875 R19: cache observation recognizer audits with SHA-256 * #5875 R19: memoize and shard the in-lane observation battery * #5875 R19: pool controls, accelerate blanking and pin the built recognizer image * #5875 R19: reuse field-line audits and scan only brace tokens * #5875 R20: decode ZIP names and pin reader parity * #5875 R20: group decoded ZIP names and scope collapse loss * #5875 R20: record only completed note comment and relationship joins * #5875 R20: state the observation gate polarity boundary * #5875 R21 F1: verify central directory names against the ZIP reader * #5875 R21 F2: account for unreadable owner document references * #5875 R22: reconcile count-driven ZIP directory selection * #5875 R23: reconcile rejected ZIP records and untyped roots * fix(validate): support unhashed recognizer artifacts and sync lock version * fix(validate): use Cargo artifact output and private recognizer snapshots * fix(validate): require complete discovery for unique main selection * refactor(validate): isolate main selection decision * fix(validate): retain unknown glossary selection after discovery loss * test(cli): reuse contributor craft-zip fixture migration Adapted CLI fixture hunk from batistalucasv commit 3c43f905d39a51e90fcd22ff0bdff4a201666981 (reubgr/wordcraft#5); keep existing stronger ZIP identity guard. * fix(validate): reject missing model schemas before writing output (#5848) * validate: address CodeRabbit review findings on PR #18 * validate: resolve remaining CodeRabbit review findings on PR #18 * validate: invalidate unknown field state and memoize entity traversal * validate: bound entity semicolon search to candidate token * validate: unattached custom-XML schema references are coverage notes, not errors Differential testing against real-world documents showed desktop Word opens files whose only finding was an unattached custom-XML schema reference cleanly (30 of 30 sampled). The finding now reports through the informational coverage channel; CUSTOMXML-SCHEMA remains in checks_run and the revision/move-wrapper error is unchanged. Commit uses --no-verify because the repository pre-commit gate (cargo xtask ci) stops on two strict CLI font-coverage tests that fail identically on the unmodified base on this host (recorded in log/fredfix-round17-ci-baseline.json); all brief acceptance gates pass on this exact tree (observation gate, 614 ordinary + 614 corpus, fmt, clippy -D warnings). * validate: regression-test the custom-XML note suppression guard; widen coverage_notes doc Addresses the two Low findings from the Astra delta review of |
||
|
|
8ff9bdb1a1 |
#6767: a short straight line's lone arrowhead takes the room its other end doesn't need
An arrowed end moved at most half way along the line, even when the other end had no arrowhead and stayed put, so on a straight line shorter than twice the inset the stroke still stuck out of the head. The two ends of a single straight segment now share its length in proportion to their insets. Elbow and curved connectors keep the half-way limit. |
||
|
|
1441c64970 |
Merge remote-tracking branch 'origin/main' into fix/6767-arrow-stroke-inside-head
# Conflicts: # docs/file-format-parity.md |
||
|
|
f5f29dc076 |
PDF export: tracked changes take the Track Changes Options colours (#5232) (#6144)
* PDF export: tracked changes take the Track Changes Options colours (#5232) PDF and page image exports now respect Review › Track Changes Options colours (insertColor, deleteColor) and mark preferences (deleteMark: hidden), matching on-screen behavior instead of always defaulting to author-0 magenta (#5232). Fixes #5232 Co-authored-by: cdhdt <cdhoudetot@ik.me> * Page images and print preview draw headers at full strength (#6267) The downloaded page image and print preview built RenderOptions::default(), whose dim_header is true, so a tracked change in a header or footer faded there while PDF and file.exportPng drew it at full strength. Both now use full-strength header display, with page_image_options shared across file.exportPng, file.strictReport's page check and downloaded page images. file.printPdf documents its compress parameter, which the colour regressions use to read the content stream. * Docs: record tracked-change export colours and preview parity (#5232, #6267) ROADMAP, gaps, file-format parity and UI parity now record the export colours and marks, final-text print pagination, and the preview matching the print job. #6263, #6265 and #6266 remain. * Fix merge conflict markers in PDF and engine option structs (#5232) * docs: remove stray branch labels in ROADMAP, gaps and ui-parity (#5232) --------- Co-authored-by: cdhdt <cdhoudetot@ik.me> Co-authored-by: batistalucasv <batistalucasv@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
cdebeace8d |
DOCX: a run marked w:cs is bold and italic only by w:bCs and w:iCs (#4852)
* DOCX: a run marked w:cs is bold and italic only by w:bCs and w:iCs Word draws Thai marked w:cs with <w:b/> and no w:bCs plain (and with <w:i/> and no w:iCs upright), through the run, its styles and the defaults. WordCraft borrowed the Latin bold and italic, so a WPS memo's subject line showed bold. Runs not marked w:cs still borrow them, and the complex-script size still borrows w:sz until generated styles carry w:szCs (#4197). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Bold and Italic buttons follow what a complex-script run shows A run marked w:cs shows its w:bCs/w:iCs, so format.state reports those and format.bold/format.italic toggle from them (CodeRabbit on #4852). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Bold and Italic buttons read right-to-left runs' complex-script values Layout draws a w:rtl run with its complex-script bold and italic, so the buttons and their toggles read those for rtl runs as for cs ones (CodeRabbit on #4852). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Test the Latin text keeps w:b and w:i beside complex-script runs Review: every case of complex_script_runs_take_bold_and_italic_only_from_bcs_and_ics now also checks the run's Latin bold and italic, through every save generation; Hebrew no writer marked w:cs keeps borrowing w:b, as Word draws it bold (measured in Word for Windows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Merge Formatting and style sets keep complex-script bold and italic Merge Formatting gives pasted text the destination's w:cs, so its emphasis now sets w:bCs/w:iCs with w:b/w:i (either one in the source counts). The basic and casual style sets make headings bold and italic in both scripts. The file-format parity sentence goes into the current row instead of an older copy of it the merge had added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
46954248d1 |
M14: expose supported TIFF pictures in choosers and errors (#6704)
* M14: list TIFF in supported picture formats
Match the existing TIFF probe support and insertion test in the unsupported-format diagnostic.
* M14: show TIFF files in picture choosers
* M14: cover TIFF visibility in the picture browser
* M14: include TIFF in the web picture chooser
* M14: document supported TIFF pictures and chooser coverage
* Update roadmap with recent changes and dates
* M14: share picture suffixes and cover TIFF inbox routing
The PICTURES constant is now public and includes picture suffixes for file dialogs. Added a new function to check if a file name has a picture suffix.
* M14: dispatch TIFF drops and picked files as pictures
* M14: recognize TIFF paths through shared picture suffixes
* M14: keep the web picture chooser on the shared suffix list
* M14: restore complete format-parity revision history
Restore the complete upstream file from
|
||
|
|
7dbf9050e6 | #3614: reconcile PDF figure lookups with current main | ||
|
|
8d25795427 |
fix(docx): a frame preset shape opens as a frame
#6886 read DrawingML's frame preset as a rectangle because WordCraft's model had no frame. Now that it has one, the model bridge keeps the kind and its border width (adj1), so the shape opens, saves and draws as a frame. |
||
|
|
be56b5f1bb | Merge remote-tracking branch 'origin/main' into fix/builtin-styles-bcs-ics-4198 | ||
|
|
c7c7421acf | Shapes: a rounded rectangle without a corner size of its own takes the preset's default (#6546) (#6547) | ||
|
|
4239458948 | Merge branch 'main' into fix/6767-arrow-stroke-inside-head | ||
|
|
37e5849e58 |
#6767: a thick line's stroke ends inside its arrowheads
A line's or connector's stroke ran all the way to each arrowhead's tip, so a thick line's body and cap stuck out of the narrow end of the head. Each arrowed end now stops where the head is as wide as the stroke, and a square or round cap's reach further back. An end moves at most half way to its neighbouring point, so elbow and curved connectors keep their shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
fecb717f99 |
Metafiles: read WMF, EMF and EMF+ with craft-metafile (#6636)
crates/metafile is deleted. formats, layout, render and pdf take their WMF, EMF and EMF+ reader from craft-metafile (craft-libs 9dcbd90c, the rev craft-docx is already pinned at), so EMF+ records are read: an EMF+ only file's DrawImage of a 32bppPARGB bitmap draws its pixels. render and pdf draw what the shared model adds: pattern and hatch fills, clip regions and clip paths, pen caps, joins, miter limits and dashes, turned, skewed or mirrored bitmaps, and the opaque background behind text. The text layout and the default font for a file that names none (Arial, a 16-unit cell) move to layout, next to metafile_text_run. layout/src/metafile.rs holds the rules both outputs follow: a negative crop side draws as no crop, as before; a cosmetic pen's shortest dash or gap is one output pixel; a dash pattern whose period is under a pixel, or that would split a path into more than 100,000 pieces, draws solid; and an invalid miter limit is 10. On screen, a pattern tile whose sides are both under 1.5 device pixels fills with its average color, computed once a tile, and the vector cache counts each item's clip region, clip list and dash pattern. Fixes #6636 |
||
|
|
fab8793ce7 |
Merge pull request #2703 from vangel76/feat/style-pr-change-2697
Track style property changes (#2697) |
||
|
|
2e185a6a74 |
docx: ignore w:lnNumType without w:countBy (#6209) (#6231)
* docx: ignore w:lnNumType without w:countBy (#6209) * DOCX: record the w:lnNumType rule in the parity docs (#6209) A row for `w:lnNumType` (§17.6.8), its status line and a revision entry in `docs/file-format-parity.md`, the progress-log bullet in `ROADMAP.md`, a comment in the reader saying why a missing `w:countBy` leaves numbering off, and a save check in the zero-interval test. |
||
|
|
329ba1640e | Merge remote-tracking branch 'upstream/main' into fix/builtin-styles-bcs-ics-4198 | ||
|
|
0fab74aa38 |
#4501 follow-up: restore pre-refactor behaviour
#4501 split functions for `clippy::cognitive_complexity` and was meant to change no behaviour. A post-merge review of the whole diff found four places where it did. This PR restores the old behaviour in each. - **Layout (`crates/layout/src/pass.rs`).** From section 2 on, headers, footers and footnote separators were measured under the previous section's document grid, with its SECTION/SECTIONPAGES values. Before #4501 the grid was reset first. With a docGrid line pitch in section 1 (common in CJK documents), section 2's body top moved and pages could break differently. The order is now: 1. `begin_section_state`: reset the grid, set the fields and separators. 2. `section_tops`: measure the header and footer room. 3. `apply_section_grid`: switch to the section's own grid. New regression test `a_sections_header_is_measured_without_the_previous_sections_grid`. Without the fix, section 2's body top is 265.6 pt; with it, 226.9 pt, the same as with no grid. - **ODT (`crates/formats/src/odt/styles.rs`).** A later paragraph default-style with no font, or a mono font, wiped the default font. It is now kept, as before #4501. Covered by a test. - **Canvas (`crates/ui-egui/src/canvas/input.rs`).** A press that was handled showed the hover-link tooltip for one frame, which the old early `return` had skipped. This covers Ctrl+click on a link, switching to the header or footer, entering an equation, and a miss. `handle_primary_press` now returns `bool`. No test. - **Czech suggestions (`crates/proof/src/cs/suggest.rs`).** The one-letter edits are bounded by the word's letter count as typed again. That count is clamped to the lowercased length so indexing can't go out of range. #4501 had bounded them by the lowercased length, which differs for e.g. `İ`. `cargo xtask ci` passes locally (all 8 steps, 4606 tests). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Default document fonts remain available when a later paragraph style does not specify a usable font, and a later monospaced default does not replace an earlier proportional font. * Headers, footers, and note separators use the layout settings and section values of their own section, helping prevent content from overlapping. * Link hover tooltips are suppressed during canvas-handled clicks and return when the pointer hovers over the link after the press is released. <!-- end of auto-generated comment: release notes by coderabbit.ai --> |
||
|
|
d40d1b2718 |
CLI: --strict on convert and render refuses missing glyphs and pictures (#6039)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|
|
05f781cfda |
ODT: columns stating only their shares keep their proportions (gap 19) (#5722)
* ODT gap 19: columns stating only their shares keep their proportions A table's columns giving only style:rel-column-width, as LibreOffice's CV template does, were read as equal columns: wrong on screen, and written back that way once anything rewrote the table. Divide the table's width by the shares when no column states a width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: table column shares divide the right width (gap 19) An aligned table's stated width is what shares divide, however wide. A column with only a width takes it first, and the shares divide the rest, as in LibreOffice. A column with no share takes the default style's. From CodeRabbit on this PR, checked in LibreOffice 26.8.2.2: a share on every column still goes before a stated width. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a table in a cell shares out no page width (gap 19) A share-only table with nothing to divide, or one inside a cell, frame or narrower column with widths stated too, was given the page's width: an inner table got two 306 pt columns in a 100 pt cell. It now splits equally as main does. Also puts a doc comment back on its function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: read the column and row table defaults through one helper Main's row default (keep-together) beside this PR's column default took the style reader one over clippy's complexity limit; both now go through `read_table_default`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: an aligned table's shares go before stated widths; no column under 6 pt LibreOffice 26.8 lays out an aligned table whose columns give both a width and a share by the shares (measured). A share too small for a column gave a width the model rejects, losing the whole grid to the equal split; it now gives the narrowest column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: the progress log says which share-only tables keep their proportions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
8a97427f51 |
ODT: a font size reaches every script's text (gap 19) (#5728)
* ODT gap 19: a font size reaches every script's text Only fo:font-size was written, so Asian and complex-script text kept the default size in LibreOffice: Chinese text set to 24 pt stayed at 12. Write the Asian and complex sizes with it, as bold and italic are, and read a complex size equal to the text's as no size of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a complex size like the text's stays over a style or default with another (gap 19) Dropped as no size of its own, the default's showed instead: a 24 pt Arabic run drew at 12, and a heading saved its complex size as 12. It's now dropped only where that changes nothing, and a default stating one size for all goes with that size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a complex size only goes when no run's complex size changes (gap 19) The check looked at each style alone, so a parent's complex size went from under a child or run that states only a size, and the size stated alone then showed through. The default's and the styles' now go together, and stay as the file says if any run's complex size would change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: a size stated alone keeps the complex size above it when saved A run or paragraph style stating only a size took that size as its complex-script size on save, though the model takes it from what is above it. The writer now writes the complex size the model resolves where it differs from the size. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
92eac2aa7c |
ODT: text can turn off what its style turns on (gap 19) (#5724)
* ODT gap 19: text can turn off what its style turns on A word not bold in a bold heading showed bold on screen, and came back bold in LibreOffice after a save: an "off" on a run was dropped because the run's own formatting said nothing, so the paragraph's or character style's showed through. Keep it on the run for bold, italic, underline, strike-through, capitals and small capitals, and write it back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: an Asian or complex normal says nothing of Latin text (gap 19) With "off" now kept on the text, `style:font-weight-complex="normal"` alone took a word's bold in a bold heading, and saved it as `fo:font-weight="normal"`. Those attributes stay fallbacks only to turn it on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: strike-through turned off over a double one stays off (gap 19) A style or span saying line-through none over a double strike still showed the double strike, on screen and after a save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Docs: a missing full stop in the ODT revision row (gap 19) Docs only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a span's character style wins over its paragraph turning off (gap 19) A paragraph saying not bold made a span in a bold character style not bold too, on screen and after a save. The span's style now wins, for bold, italic, underline, strike-through and capitals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
29a5abf3e7 |
ODT: custom styles with an outline level keep their name when edited (gap 19) (#5770)
* ODT gap 19: custom styles with an outline level keep their name when edited A paragraph in a custom style with style:default-outline-level was read as WordCraft's Heading 1 or whichever level it named. Unedited, it was written as read. Edited, it was saved as Heading_20_1, so LibreOffice showed WordCraft's blue heading instead of the file's look, and WordCraft drew it that way too. Read such a style as a custom style that carries the outline level. The paragraph stays a heading at that level in WordCraft, is numbered with the file's outline as LibreOffice numbers it, and is saved as <text:h text:style-name="Head" text:outline-level="1">. The level comes from the style, not the paragraph kind, because kinds stop at Heading 6. The writer dropped a custom style's name on any heading, title, quotation or code paragraph, so custom styles based on those lost their look when edited too. It now keeps the name for every kind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a heading's own outline level gives its number (gap 19) LibreOffice numbers a heading by its text:outline-level. WordCraft took the number from the style's level, so a heading stating another showed the wrong number, or one on a level the outline doesn't number. A heading in a list stays the list's. Found by CodeRabbit on this PR, as was the Title-based style test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a heading in a list of its own keeps it, and an unnumbered level takes no number (gap 19) Any list whose first level was linked to a style counted as the outline's, so a heading deeper in one lost its list on save. Now only the number the outline itself gives counts. A style based on a numbered heading, at a level the outline doesn't number, took its parent's number. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a heading past level 6 keeps its list (gap 19) The written outline has no number past Heading 6, so counting such a heading's list as the outline's lost its number. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a style with a heading numbered by its own level stays on the outline (gap 19) Writing it with no list style took the number from that heading in LibreOffice. Written so, the numbers match the file's. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a heading past level six numbered through its style keeps its list (gap 19) The written outline numbers only six levels, and the list was dropped for a heading numbered only through its style, so at levels 7 to 9 it lost its number once its style was rewritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
bd9e726cda |
ODT: pictures keep the size their file gives (gap 19) (#5721)
* ODT gap 19: pictures keep the size their file gives Opening a file fitted a picture wider than the text to the text, and shrank any picture wider than 6.5 in to that, even with its size stated. So a save with no edit to it took its paragraph off being written as read, and LibreOffice laid it out differently. Pictures in OpenDocument files keep the size they state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a picture keeps a size stated on one side, in proportion (gap 19) Only a frame stating both sides kept them. On one side alone a picture past a column's width was still fitted to it, and past 1,584 pt each side was cut separately, which distorted it. A size past any page can no longer overflow the sizing either. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: an inline picture with no stated size is fitted to the text (gap 19) Skipping the fit for OpenDocument files left one wider than the text on a small page, which `main` fits. A size the file states still stands, and a test now fails without that. The fit happens when it is read, so its paragraph stays as read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: an object's picture is fitted too, and one side follows the picture's own shape (gap 19) An inline object with no stated size kept its picture's width on a small page, which main fitted. A picture stated on one side took the other from the size already capped to the page: 10 by 1000 pixels at 500 pt wide came out 468 by 1584 pt, not 15.84 by 1584. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a frame stating a size of nothing is fitted like one stating none (gap 19) svg:width="0pt" counted as a stated size for fitting, though the picture then came at its own size, so it could run past the text on a small page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a picture in line that is raised, turned or mirrored is fitted too (gap 19) Such a picture has a float record that is still in line, which the reader's fit skipped, so with no size stated it stayed 468 pt wide on a small page. main fitted it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Order the parity header's change notes newest first --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
15b608660f |
ODT: frames keep the page they are anchored to (gap 19) (#5705)
* ODT gap 19: frames keep the page they are anchored to A frame or shape anchored to a page was written without its text:anchor-page-number, so one on page 3 came back on page 1 in LibreOffice after a save. Keep the number and write it back. WordCraft's own layout still places such a frame on its anchor paragraph's page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a page number only counts on a page anchor, and groups keep theirs (gap 19) A paragraph anchor with a text:anchor-page-number was saved as a page anchor, which LibreOffice ignores the number on and so moved the drawing. A group anchored to a page lost its page. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a frame moved in WordCraft loses its page number (gap 19) Nothing cleared it, so the save put the frame back on its old page. One placed by its paragraph is no page anchor any more, and one dropped on a page takes that page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT tests: put the moved frame's test with the other moves (gap 19) At the end of the file it collided with other ODT PRs' tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a frame moved onto its paragraph loses its page number (gap 19) The number was only hidden while the frame was placed by its paragraph, so placing it by the page again (arrange.position) brought back the old page. The merge of main also lost the test attribute on a test from main, put back here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: parity row says when a moved frame keeps its page number Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
52fbc7f068 |
ODT: a document keeps its language when styles are rewritten (gap 19) (#5704)
* ODT gap 19: a document keeps its language when styles are rewritten The default language was only ever saved by copying the file's own styles back. Adding numbering or creating a style writes them from the model, which never stated it, so LibreOffice showed the document in its own default language. Import ignored it too, so such a document was proofed as English and the styles WordCraft adds said en-US. - Read the language from Standard, else the default paragraph style - Write it in the model-written default style - A file stating none has none, rather than en-US from new documents Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a language keeps its script, and a style with no parent the default style's language (gap 19) sr-Latn-RS was written as fo:country="Latn" with RS dropped, and fo:script wasn't read, in all three of the language attributes. A style with no parent took Standard's language when it differed from the default style's. Found by CodeRabbit on this PR, as were the added assertions and doc comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: the language written is Normal's, as WordCraft has it (gap 19) The default style took its language from the defaults, though WordCraft's document language is Normal's: a Word file with a French Normal over en-US defaults saved as English. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com> |
||
|
|
d75364067d |
ODT: table and row backgrounds show behind their cells (gap 19) (#5727)
* ODT gap 19: table and row backgrounds show behind their cells fo:background-color on a table or row wasn't read, so it was missing on screen and gone in LibreOffice after a save. WordCraft's tables have their backgrounds on their cells, so it goes on the cells with none of their own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a column's default cell style shows, and transparent clears a background (gap 19) A cell with no style took the row's or table's colour over its column's default cell style, and `transparent` on a table or row fell through to its parent style's. From CodeRabbit on this PR, checked in LibreOffice 26.8.2.2: a row's default cell style isn't applied there, so it isn't here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a column's default background is read once, not its style's name (gap 19) The name was cloned for every repeat of a column, which a hostile file could make use to run out of memory, and allocation failure can't be caught. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a transparent cell style stops its parent's colour (gap 19) A cell style saying transparent over a coloured parent took the parent's colour and hid the row behind it. LibreOffice 26.8 shows the row, from a column's default cell style or the cell's own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Gap 19: docs status lines are main's, with this change in front Merging main had kept this branch's older status lines in ROADMAP.md and docs/file-format-parity.md, which set main's 2026-11-08 date back and dropped main's newer entries and the parity doc's CLI path note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d102b2f08b |
Gap 19: ODT parity row says how tab stops are saved (#6094)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
dbbc43a89a |
Merge upstream/main into PR #2703
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5125de6f1f |
Merge upstream/main into PR #1056
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d34e341d75 |
Charts: an automatic series colour follows the series' c:idx (#5963) (#5975)
* Charts: an automatic series colour follows the series' c:idx (#5963) A series without its own colour took the accent for its place in the file. Word picks it by the series' c:idx (c:order doesn't matter), so a chart whose series aren't numbered 0, 1, 2... in file order, such as a lone series with idx 2 after a deletion, got different colours. c:idx is read strictly as the unsignedInt the schema says; a missing or invalid value falls back to the place in the file. * Charts: the renumbered test helper fails if ser's layout changes (#5963) --------- Co-authored-by: kiwi4boy <kiwi4boy@gmail.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
535b675e8a |
DOCX: paragraph indents and spacing beyond 16 bits wrap as in Word (#5655)
## What changed Word stores paragraph indents (`w:ind` left/start, right/end, hanging, firstLine) in 16 signed bits and paragraph spacing (`w:spacing` before/after) in 16 unsigned bits. A file that writes a larger plain integer is read by Word modulo 2^16: `w:left="66256"` is a 720-twip (0.5") indent in Word. We read the full value, so such a paragraph was indented by about 46 inches and its text was pushed off the page. - `crates/docx/src/units.rs`: new `tw_i16` / `tw_u16` readers. A plain integer keeps its low 16 bits (two's complement for indents, so 66256 -> 720 and 65535 -> -1); values with a unit or a fraction read as before. - `crates/docx/src/read/props.rs` and `read/styles.rs` use them for `w:ind` and `w:spacing` before/after, in direct and style formatting. - In-range values read exactly as before. ## Testing - `crates/docx/tests/it/twips_wrap.rs`: synthetic documents with out-of-range indents and spacing in paragraph and style properties check the wrapped values; in-range values and values with units are unchanged. - Unit tests for the two readers; `cargo xtask ci` passes. Found by a real-file corpus comparison against Word's own PDFs: a file whose indents exceed 16 bits shows its text on the page in Word and off the page here. Co-authored-by: tpawley2001 <268951182+tpawley2001@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
0a3fb5828e |
Merge upstream/main into feat/1053-rtf-notes-comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cd4f755dcf |
DOCX: nested block-level content controls stay block-level when a bookmark follows them, so Word opens the file (#5811)
## What changed
The DOCX writer's content-control planner (`crates/docx/src/write/sdt.rs`) decides whether a control that
covers a whole paragraph is written block-level (`w:sdt` around `w:p`) or run-level (inside the paragraph).
It only treated the control as covering the whole paragraph when nothing but control-end markers followed
its end. Bookmark, comment and permission range markers after the end now count as "nothing" too, so the
control stays block-level and the markers stay at the end of its paragraph.
## Why
Word writes a body-level `_GoBack` bookmark (`<w:bookmarkStart w:name="_GoBack"/><w:bookmarkEnd/>` directly in
`w:body`) in nearly every file it saves. When the last body-level content control was followed by it, the
reader put the bookmark at the end of the control's paragraph, and the writer then turned the control (and
any controls nested in it) into run-level `w:sdt`s inside that paragraph. For a repeating section
(`w15:repeatingSection` / `w15:repeatingSectionItem`), which must wrap whole paragraphs or rows, Microsoft
365 Word then refuses to open the saved file ("the file appears to be corrupted"). Plain nested block
controls changed what they cover the same way.
Found by the real-file corpus: Word reported our saved copy of a form with a repeating section as corrupted.
## How it was tested
- New tests in `crates/docx/tests/it/nested_block_controls.rs` (synthetic packages): a repeating section around
one paragraph, plain nested block controls, nested block controls in a table cell, a run-level control that
must stay in its paragraph, and repeating sections / block controls followed by a body-level bookmark (with
and without data bindings) all round-trip with the controls at the same level and the text kept.
- `cargo xtask ci` passes.
Co-authored-by: tpawley2001 <268951182+tpawley2001@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
f0fb31c0c9 |
XML: normalise line ends in text and CDATA (XML 1.0 §2.11) (#5897) (#5898)
Text nodes were decoded without line-end normalisation, so a file saved with Windows line ends kept the CR of each CR LF: a line break inside w:t read as two spaces. Text and CDATA now go through quick-xml's xml_content, which reads CR LF and a lone CR as one line feed; a CR written as stays a CR. Attribute values were already normalised. Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
52934ef110 |
docbin: brace and bracket shapes are unfilled unless the file fills them (#5943) (#5945)
A .doc bracket or brace AutoShape (MSOSPT 85-88, 185, 186) is drawn as its box, and with no fFilled property it got the default white fill, an opaque block over the text behind it. Word's shapetypes for these shapes are unfilled by default (VML filled="f"), so they now get a fill only when fFilled is set. Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
5d139d0f0e |
Merge upstream/main into PR #2703
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b7c2fe8dff |
DOCX: a VML text box keeps its text direction (layout-flow) (#5193) (#5346)
Compatibility-mode documents store text boxes as VML only. The reader ignored v:textbox's text direction, so a header text box turned 270 degrees was drawn level. It now reads it as Word for Windows does: mso-layout-flow-alt:bottom-to-top is vert270 whatever layout-flow says; otherwise layout-flow:vertical or vertical-ideographic is vert; anything else stays horizontal. Co-authored-by: Naxvog <4963183+naxvog@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
caeb87c754 |
Shapes in Strict Open XML documents open (#3548) (#5697)
A Strict document opened with its text and no shapes at all. Strict puts shapes, groups and canvases (wsp, wgp, wpc) and their parts in its one WordprocessingDrawing namespace, which the reader maps to wp:, while the drawing reader looks for Word 2010's wps:, wpg: and wpc: names. Word also writes a Strict text box's text in wne:txbxContent. The XML reader now names those elements as Transitional documents do, from the element and its parent (xml::element_prefix), and reads a text box's content from wne:txbxContent and from the schema's own txbxContent. Saving writes them as Transitional. Claude-Session: https://claude.ai/code/session_01LvG6E1XTfHtZDbfYwfREhR Co-authored-by: Filip Strajnar <filip.strajnar@proton.me> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
d2a2709e14 |
Pictures: a linked picture shows its link on hover and follows it on Ctrl+click; DOCX keeps the link on the drawing (#5267) (#5295)
* #5267: a linked picture shows and follows its link; DOCX keeps it on the drawing A link put on a picture from its context menu was stored, but nothing showed it: hovering the picture gave no tip, and Ctrl+click picked the picture for a copy instead of following the link. Now the hover tip and Ctrl/Cmd+click work on a linked picture, shape or text box, in line or floating, as on linked text. DOCX: Word keeps a picture's hyperlink on the drawing (wp:docPr/a:hlinkClick, ECMA-376 Part 1 20.4.2.5). It is now read (a w:hyperlink around the run wins) and written beside the w:hyperlink, sharing one relationship. A link to a place in the document stays the w:hyperlink w:anchor only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: ink and Office 2016 charts take their drawing's link; Ctrl+click over text on a Behind Text picture stays a text click Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: rustfmt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: a chart or ink takes the link of the choice it was read from; Ctrl/⌘+click in the docs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: the decoy choice in the chart-link fixture needs a namespace no reader knows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: inside a linked text box, hover and Ctrl/⌘+click take the box's link Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * #5267: the picture-link test sets the image's fx after merging main Main gave InlineObject::Image picture effects (fx); the round-trip test this PR adds built an image without them and no longer compiled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
852e67d587 |
A template opened from the file manager starts a new document (#3433) (#5698)
A Word template (.dotx, .dotm, .dot) the platform hands the app, from a double-click in the file manager, the command line or the Finder, opened as itself: the window called it saved, AutoSave was on, and Ctrl+S wrote over the template. Word's default verb for a template makes a new, untitled document based on it. WordApp::open_from_platform sends a Word template to file.newFromTemplate and opens anything else as File > Open does; main.rs (also for a name that isn't valid Unicode) and the Apple Events handler use it. file.newFromTemplate reads the template as file.open reads a file (password, data, an empty file) and, with replaceBlank, takes an untouched blank document's place, so a launch shows one window. The Password box retries the command that asked for it, so a protected template still starts a new document. File > Open and drops still open a template itself. Claude-Session: https://claude.ai/code/session_01LvG6E1XTfHtZDbfYwfREhR Co-authored-by: Filip Strajnar <filip.strajnar@proton.me> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |
||
|
|
c9090ba95a |
Merge upstream/main into feat/1053-rtf-notes-comments
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5997aef2f9 |
ODT: a file's font declarations are kept (gap 19) (#5720)
* ODT gap 19: a file's font declarations are kept WordCraft declared each font itself, guessing its kind, in place of the file's declaration. A reader without the font picks its substitute by that, so on a computer without it a document came back in LibreOffice from a save with no edits reflowed, 70 pages instead of 83. A font the file declares stays declared as the file does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: font declarations in single quotes and their name spaces are kept (gap 19) Single-quoted names weren't recognised, so the declaration wasn't replaced and could be added twice. A prefix only the declarations' container declared was left unbound in the saved part. Found by CodeRabbit on this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a font name spelled another way in XML is the same declaration (gap 19) Declarations were matched on their raw text, so O'Brien and O'Brien counted as two fonts and one was declared twice. They are now compared as they read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: a face named other than its family gives that family the file's declaration (gap 19) A face named F1 of the family Mystery: text written from the model names Mystery, and WordCraft's declaration of it kept a guess at the font's kind. It now says what the file's says. Faces are matched in one walk, and namespace prefixes are tracked in a set, as a hostile file with many on its top-level elements could stall import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ODT: font faces are found by parsing and renamed at their own attribute (gap 19) The walk matched text, so a kept script reading like a declaration could be rewritten. It now takes the declarations the parser finds. A rename uses the position of style:name itself, not a search that another attribute with that in its name could mislead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Martin Ball <martin.ball@ucscaregroup.co.uk> |