Skip to content

Read getters, hyperlink write, and inline-image readback#6

Open
hanthor wants to merge 9 commits into
tensorbee:mainfrom
hanthor:main
Open

Read getters, hyperlink write, and inline-image readback#6
hanthor wants to merge 9 commits into
tensorbee:mainfrom
hanthor:main

Conversation

@hanthor

@hanthor hanthor commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Six additive commits extending the read and write surface, driven by real consumer needs in tuna-os/gtk-office-suite (a GNOME office suite using rdocx as its OOXML layer, with fidelity measured against a LibreOffice-based conformance corpus in CI):

Read getters (all round-trip tested via to_bytes/from_bytes):

  • ParagraphRef::numbering()(num_id, level) + Document::numbering_is_bullet() — list readback
  • RunRef::highlight() — covers both w:highlight and the shading-fill mechanism the existing highlight() builder writes
  • RunRef::is_underline() (excludes none) and ParagraphRef::is_page_break_before()
  • RunRef::inline_image()(rel_id, alt) + Document::image_data(rel_id) — byte-identical picture round-trip
  • ParagraphRef::hyperlink_spans() + Document::hyperlink_url() — positional link readback

Write support:

  • Document::append_hyperlink(text, url) with proper TargetMode="External" (new Relationships::add_external in rdocx-opc)
  • Document::last_paragraph_mut() for interleaving plain runs with hyperlinks

Each addition has a round-trip test; the full workspace suite passes. Everything is additive — no signature changes to existing APIs (one exception: none; RunRef::highlight is a new method, the builder Run::highlight is untouched).

Downstream, these getters are exercised by ~120 external conformance tests (DOCX round-trip suite + a 104-scenario corpus where LibreOffice authors the documents), so they're validated against both our writer's output and Writer's.

🤖 Generated with Claude Code

hanthor and others added 6 commits July 18, 2026 06:34
- ParagraphRef::numbering() -> (num_id, level) + Document::numbering_is_bullet
- RunRef::highlight() covering both w:highlight and shading-fill mechanisms
- Relationships::add_external (TargetMode=External) in rdocx-opc
- Document::append_hyperlink: external URL on the last paragraph

All verified by to_bytes/from_bytes round-trip tests. Driven by the
gtk-office-suite letters-core parity corpus (its red tests name these
exact gaps).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Positional hyperlink readback: spans as (run_start, run_end, rel_id)
with rel_id -> URL resolution, so consumers can map links onto runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…data

Round-trip test embeds a PNG via add_picture and reads it back byte-
identical. Driven by gtk-office-suite letters-core image fidelity work.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hanthor added a commit to tuna-os/gtk-office-suite that referenced this pull request Jul 18, 2026
…data

Publishing state: rdocx additions PRed upstream (tensorbee/rdocx#6);
letters-core publish blocked on that release (crates.io forbids git
deps) and on cargo login. Blog post is a draft for review.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hanthor added a commit to tuna-os/gtk-office-suite that referenced this pull request Jul 18, 2026
…ables-core 0.1.0

letters-core/decks-core publishing blocked on the rdocx upstream
release (tensorbee/rdocx#6) — crates.io forbids git dependencies.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hanthor and others added 2 commits July 18, 2026 17:02
Reads w:spacing/@w:line as a multiplier when @w:lineRule is auto (or
unset) — the counterpart of the existing line_spacing_multiple setter.
Exact/atLeast point spacing returns None. Round-trip test included.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ph::add_footnote_ref, RunRef::footnote_id

footnotes.xml round-trips through the package: loaded on open via the
FOOTNOTES relationship, written back with content-type and rel on save.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant