Skip to content

v0.13.13

Choose a tag to compare

@GitHubNewbie0 GitHubNewbie0 released this 07 Aug 14:45
· 75 commits to main since this release

Fixed

Paragraph direction is now modelled in both conversion directions.

odf-kit did not represent style:writing-mode anywhere: htmlToOdt()
discarded the dir attribute, and odtToHtml() never read the ODF attribute
back.

This mattered more than it sounds, because a right-to-left paragraph is
right-aligned by default — so editors write no explicit alignment for it at
all. A document whose alignment was carried by its direction arrived
left-aligned, with no alignment value having been lost. That is why the same
defect surfaced as two separate bug reports about alignment.

htmlToOdt() now maps the dir attribute and the CSS direction property
onto style:writing-mode — inline CSS takes precedence, matching browser
resolution, and dir="auto" has no ODF equivalent so is not emitted.
odtToHtml() renders right-to-left modes as a dir attribute on the paragraph
or heading. Vertical writing modes are carried in the reader's model but not
rendered.

Direction and alignment are handled independently, so a right-to-left paragraph
with explicit left alignment round-trips correctly. ParagraphOptions gains
writingMode, and its align option now also accepts the direction-relative
start and end values that the ODF grammar permits and that Word writes on
export.

Verified against a real Qt-authored Arabic document: 14 right-to-left
paragraphs survive HTML → ODT → HTML intact, with the generated file passing
the OASIS validator.

Fixes #81 and #82 — the same missing concept at opposite ends of the pipeline.
Thanks to @abdulrahman-103 for both reports and the documents used to verify.

Added

Reader fixture corpus. tests/reader/fixtures/ gains its first committed
documents — alignment-ltr.odt and alignment-rtl.odt, authored in
LibreOffice Writer with full provenance and regeneration recipes.

Added

Custom page dimensions in the HTML, Markdown, Lexical, and TipTap
converters.
pageWidth and pageHeight options accept any ODF length
("215.9mm", "8.5in", "21cm") and override the pageFormat preset.
Values are written to the document exactly as given, including mixed units
across dimensions and margins — a page can be sized in millimetres with
inch margins and every value survives verbatim.

Completes #76: custom margins were already supported, and line spacing /
paragraph spacing shipped in v0.13.12. Thanks to @abdulrahman-103 for the
request.

Fixed

Orientation detection and the landscape swap are now unit-aware. Both
the reader (deriving portrait/landscape from page dimensions) and the
writer (swapping dimensions into landscape order for
orientation: "landscape") previously compared bare numbers with the
units stripped — a page 11 inches wide by 21 centimetres high compared as
11 < 21 and was reported portrait despite being physically landscape.
Both sites now compare through the exact-rational length core, so
mixed-unit dimensions resolve correctly. Documents whose dimensions share
a unit — every document produced by the converters' presets — were
unaffected.

Full Changelog: v0.13.12...v0.13.13