Reliability fixes
- Fixed single-file conversion error handling.
- Single-file conversions now return conversion/open errors instead of logging them and exiting successfully.
- processBook now logs "Conversion failed" on normal returned errors and only logs "Conversion completed" on success.
- Improved batch conversion failure reporting.
- Directory and archive conversions now continue processing remaining books, but return aggregated per-book/per-entry failures at the end.
- Directory processing now preserves the underlying error instead of replacing it with a generic message.
- Closed batch input handles promptly.
- Directory and archive batch conversions no longer defer file/archive-entry closes inside loops.
- File and archive entry readers are closed immediately after each conversion attempt.
- Close errors are preserved with conversion errors.
Safer output writes
- Made overwrite behavior safer.
- Existing output files are no longer deleted before generation succeeds.
- Conversion now generates to a temporary file in the destination directory, then replaces the final output only after successful generation.
- Temporary outputs are cleaned up on failure.
- Windows replacement uses MoveFileEx(..., MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH).
EPUB fixes
- Improved EPUB internal link rewriting.
- EPUB link target mapping now uses actual rendered XHTML id attributes as the source of truth.
- Removed the older parallel FB2 source-tree ID collection path, which could drift from rendering behavior.
- Fixes cross-file internal links to IDs rendered in nested structures such as epigraphs and annotations.
- Keeps compatibility with split XHTML chapters and float/floatRenumbered footnote backlinks.
- Tightened EPUB helper close-error handling.
- ZIP-copy helpers now return target ZIP writer finalization errors.
- File-copy helpers now return source/destination close errors.
- Close/finalization errors are aggregated with primary copy/write errors.
KFX fixes
- Fixed KFX image resource discovery for poem substructures.
- KFX image pre-scan now includes inline images in:
- poem epigraph flow items
- poem epigraph text authors
- poem subtitles
- stanza subtitles
- stanza titles
- stanza verses
- poem titles
- poem text authors - Added documentation that collectUsedImageIDs must mirror KFX rendering paths until a render-time image registry exists.
- KFX image pre-scan now includes inline images in:
- Improved KFX cancellation responsiveness.
- context.Context is now threaded through KFX fragment building, storyline generation, and generated-section creation.
- Added cancellation checks between major KFX generation phases and inside key loops.
- KFX generation also checks cancellation around container serialization and final output writing.
Tests and validation
- Added regression tests for:
- single-file conversion error propagation
- failure logging in processBook
- batch directory/archive failure aggregation
- failed overwrite preserving existing output
- KFX poem substructure image collection
- EPUB cross-file links to rendered epigraph IDs
- KFX cancellation after generation start
Full Changelog: v1.3.7...v1.3.8