Skip to content

v0.13.12

Choose a tag to compare

@GitHubNewbie0 GitHubNewbie0 released this 07 Aug 02:55
· 82 commits to main since this release

Added

Paragraph spacing and line height in htmlToOdt().
The HTML parser now extracts margin-top, margin-bottom, and line-height
from inline styles and carries them into the generated ODT as
fo:margin-top, fo:margin-bottom, and fo:line-height. All CSS
line-height forms are handled: unitless multipliers (1.5150%),
percentages, lengths, and normal (the ODF default).

Pixel values are converted through a new exact-rational length core rather
than floating-point arithmetic. The conversion treats the source's precision
as its tolerance and emits the shortest decimal within it — so Qt's
line-height:21.6533px (a rounding artifact of 16.24pt) is recovered as
exactly fo:line-height="16.24pt", and margin-top:12px becomes 9pt.
Pixel units are never emitted.

Two deliberate exclusions: percentage margins are not extracted, because CSS
resolves vertical margin percentages against container width while ODF
resolves them against the parent style's margin — the same value means
different things in the two systems, and passing it through would be
silently wrong. Negative values for these properties are dropped, as the
ODF grammar requires non-negative lengths there.

The reading direction already existed — odtToHtml() returns these
properties as inline CSS — so paragraph spacing and line height now
round-trip in both directions.

Addresses the paragraph-spacing and line-spacing half of #76; page size and
page margins remain in progress. Thanks to @abdulrahman-103 for the request
and the real-world documents used to verify.

Exact-rational length core (src/core/length.ts) — internal foundation
for unit handling: BigInt-rational arithmetic with no floating point,
byte-exact preservation of values read from documents, interval-based
shortest-decimal conversion for quantized sources (px, twips, EMU), and
exact cross-unit comparison. Not yet exposed as public API.

Full Changelog: v0.13.11...v0.13.12