Skip to content

v2.5.1

Choose a tag to compare

@github-actions github-actions released this 21 Oct 00:45
· 48 commits to main since this release
1b19fdb

PDF Craft v2.5.1

PDF Craft 2.5.1 fixes EPUB translation previews for text/html spine documents.
Enabling translate_epub(on_body=...) now keeps text callbacks available when a
reliable source CFI cannot be generated, instead of failing an otherwise
supported translation.

Optional EPUB fragment locations

  • EpubFragmentContent.epubcfi is now str | None. Field order remains
    epubcfi, original, translated, and EpubTranslation remains an alias.
    Callers should check for None before using a location; source and translated
    plain text are still delivered normally.
  • Supported text/html content and fragments with explicitly unavailable
    source-location information receive epubcfi=None. No guessed CFI is emitted.
    XHTML fragments retain their precise source locations, including in EPUBs that
    mix HTML and XHTML documents.
  • Callbacks retain atomic-fragment granularity and source order. Document-head
    titles, navigation and book metadata are not added to body callbacks. Both SDK
    facades support synchronous or asynchronous callbacks and await async callbacks.
  • Only known location unavailability is downgraded. Actual parsing and translation
    failures, unexpected source-mapping or offset errors, and user callback
    exceptions still abort the operation. Cancellation and existing-output
    protection remain unchanged.

Coverage and documentation

Regression tests cover HTML callbacks in all three submission modes, mixed
HTML/XHTML location preservation, missing package locations, synchronous callback
awaiting, absent-callback costs, and error/cancellation propagation. The full suite
passes 930 tests; type checking, lint and 2.5.1 package builds also pass.

The English callback guide,
Chinese callback guide, API references and EPUB translation
guides document the nullable field and its error-handling boundary. Existing PCEX
formats, PDF callbacks and EPUB writeback modes are unchanged.

See #519.

Full Changelog: v2.5.0...v2.5.1