Repository navigation
v2.5.1
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.epubcfiis nowstr | None. Field order remains
epubcfi,original,translated, andEpubTranslationremains an alias.
Callers should check forNonebefore using a location; source and translated
plain text are still delivered normally.- Supported
text/htmlcontent and fragments with explicitly unavailable
source-location information receiveepubcfi=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