Skip to content

Releases: rupor-github/fb2cng

v1.3.8

09 May 19:53
34e9897

Choose a tag to compare

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.
  • 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

v1.3.7

08 May 23:32
a55f440

Choose a tag to compare

Maintenance

Switching to go1.26.3 with full dependencies update

Full Changelog: v1.3.6...v1.3.7

v1.3.6

07 May 01:08
12b2cf2

Choose a tag to compare

KFX/AZW8 rendering fixes

  • Fixed nondeterministic embedded font resource assignment in generated AZW8/KFX files.
    • Embedded fonts now keep stable resource IDs between conversions.
    • This fixes cases where paragraph/title/dropcap fonts could appear to “flip” between repeated generations of the same FB2 file.
    • Font declarations now follow deterministic @font-face order instead of Go map iteration order.
  • Fixed KFX resource ID collisions after unused image resources are filtered.
    • Font resource numbering now starts after the highest existing image resource location, not after the count of remaining raw media fragments.
    • This prevents $417 raw media and $418 raw font fragments from sharing the same resource/rsrc* ID.
  • Made fragment sorting stable for duplicate root font fragments.
    • This preserves the intended font declaration order during KFX container serialization.

KFX/AZW8 dropcap spacing fixes

  • Improved KFX handling for dropcap paragraphs followed by normal paragraphs.
    • Dropcap paragraph pairs are now wrapped together when negative horizontal margins are involved.
    • Child paragraph margins are clamped inside the wrapper to avoid Kindle/KFX dropcap layout distortion.
  • Fixed excessive spacing after dropcap paragraphs.
    • The dropcap paragraph’s bottom margin is stripped at the internal wrapper boundary.
    • Only the intended normal paragraph gap is transferred to the following paragraph.
    • Avoids leaking the default paragraph margin into dropcap layouts when CSS requested zero or smaller spacing.

Full Changelog: v1.3.4...v1.3.6

v1.3.4

06 May 11:23

Choose a tag to compare

Bug fixes

  • Fixed KFX CSS inheritance for synthetic html/body root styles.
  • Direct element rules now correctly override inherited root properties, e.g.:
      body { line-height: 100%; }
      p { line-height: 110%; }
    now emits paragraph line_height: 110% instead of being suppressed by the inherited body value.
  • Non-root container inheritance behavior is preserved, so existing nested/block style filtering remains unchanged.
  • Removing accessibility text from svg cover wrapper - it confuses AlReader and CoolReader

Full Changelog: v1.3.3...v1.3.4

v1.3.3

04 May 22:45
d28f989

Choose a tag to compare

Bug fixes

  • Fixed KFX horizontal margin handling when html/body root margins are used.
  • Normal paragraph margins now correctly accumulate with synthetic root/page margins.
  • Fixed a regression where regular paragraphs could ignore their own horizontal margins while dropcap paragraphs still appeared aligned.
  • Example now works correctly:
  html {
      margin: 0 -12pt;
  }

  p {
      margin: 0 0 0 3em;
  }
  • Root html/body horizontal margins are now treated as page/story insets, not ordinary container margins.
  • Added regression coverage for root margins combined with paragraph margins.

Full Changelog: v1.3.2...v1.3.3

v1.3.2

03 May 19:18
5d91f5c

Choose a tag to compare

Improvements: KFX dropcap layout in Kindle Previewer / Kindle rendering.

  • Removed the previous narrow no-break space (U+202F) workaround after the dropcap character.
  • Preserved normal dropcap styling, including:
    • dropcap-lines
    • dropcap-chars
    • first-letter glyph styling
    • CSS styling such as bold and letter spacing
  • Improved dropcap behavior with negative horizontal margins:
    • fb2cng now wraps affected dropcap paragraphs in an internal margin wrapper.
    • The wrapper keeps the book/page horizontal inset.
    • The inner dropcap paragraph avoids negative horizontal margins that break KP3 layout.
  • Fixed unwanted spacing after dropcap paragraphs by zeroing their KFX bottom margin.

Full Changelog: v1.3.1...v1.3.2

v1.3.1

03 May 16:59
ca78c94

Choose a tag to compare

New features:

  • Added legacy OPF2 cover metadata to EPUB3 output for Apple Books compatibility.
    • EPUB3 now emits both:
      • meta name="cover" content="book-cover-image"
      • properties="cover-image" on the actual cover image manifest item.
    • The legacy cover meta points directly to the raster cover image, while cover.xhtml continues to use the SVG wrapper.
    • Added EPUB3 OPF test coverage for the Apple-compatible cover metadata.
  • Added configurable device TOC nesting via document.toc_type.
    • Supported TOC types:
      • normal — preserve full section nesting.
      • old_kindle — restrict nesting for old Kindle/kindlegen compatibility.
      • flat — make navigation entries top-level siblings.
    • Kept generated visible TOC pages unchanged for EPUB2, EPUB3, and KFX.
    • Removed presentation classes from EPUB3 nav.xhtml.
    • Added shared TOC shaping helper and tests.
    • Added regression tests for normal, old_kindle, and flat nesting in EPUB2, EPUB3, and KFX.

Full Changelog: v1.3.0...v1.3.1

v1.3.0

02 May 20:47
4b01dab

Choose a tag to compare

New features

  • Added KFX html/body root style handling with inherited root properties, descendant selectors, and horizontal root margins.

Bug fixes

  • Fixed backlink style events to use inline delta styling so margins and block properties do not affect backlink rendering.
  • Fixed KFX title width handling with negative root margins.
  • Prevented root horizontal margins from being reapplied to nested title children.
  • Fixed title inline images being oversized by avoiding heading-font scaling for title art.
  • Added regression tests for title child margins and fixed-size title inline images.

Full Changelog: v1.2.8...v1.3.0

v1.2.8

02 May 16:31
44f5540

Choose a tag to compare

Maintenance

Use latest action versions in the release pipeline

Full Changelog: v1.2.7...v1.2.8

v1.2.7

02 May 16:14
2261bdb

Choose a tag to compare

EPUB Cover Improvements

  • Fixed generated cover.xhtml CSS typo (height was misspelled), improving cover page sizing for EPUB2 and EPUB3.
  • Added EPUB3 structural semantics to cover pages:
    • xmlns:epub namespace declaration
    • epub:type="cover" on the cover page
  • Improved cover accessibility by adding SVG text alternatives:
    • <title> uses FB2 cover image alt text when available, otherwise Cover
    • uses Cover image for when available
  • Added tests for EPUB3 cover semantics and SVG accessibility text.
  • Validated generated EPUB2 and EPUB3 files with EPUBCheck; no errors or warnings.

Maintenance

  • Updated dependencies
  • Removed minisign and simplified action pipeline
  • Updated external data download tasks:
    • Switched TeX hyphenation dictionary download from legacy CTAN directory scraping to hyphenation-utf8.zip via mirrors.ctan.org.
    • Updated dictionary setup notes accordingly.
    • Strengthened Taskfile status checks for dictionary and sentence model downloads to detect partial/incomplete data sets.

Full Changelog: v1.2.6...v1.2.7