Commit graph

35 commits

Author SHA1 Message Date
Ryo
13c8eea68a fix: handle binary formats and verify -V flag adjacency
Address second round of cubic-dev-ai review feedback:

P1: detectCJKFont only scans raw file bytes for CJK characters, which
misses CJK content inside compressed/binary formats (docx, epub, odt,
pptx). For these formats, always pass a CJK font to avoid missing glyphs.
Text formats still use content-based detection.

P3: Test assertions only checked that CJKmainfont value exists in args
array but did not verify -V flag precedes it. Added assertCJKFontArg
helper that checks -V adjacency for all CJK font tests.

Changes:
- Add binaryFormats set for docx/epub/odt/pptx
- Binary formats always get Noto Sans CJK SC (cannot detect language
  from raw bytes, SC is the safest default covering all CJK characters)
- Text formats continue using detectCJKFont for locale-aware detection
- Add assertCJKFontArg helper verifying -V precedes CJKmainfont value
- Add 3 new tests for binary formats (docx, epub, odt) with -V check
- 14 tests total, all passing
2026-07-02 10:43:26 +08:00
Ryo
0abd934046 fix: make CJK font conditional and locale-aware
Address code review feedback from cubic-dev-ai:

P1: Unconditionally passing CJKmainfont broke non-CJK conversions in
environments without CJK fonts. Now the source file is scanned for CJK
characters and the font argument is only added when CJK content is
detected.

P2: Hardcoded Noto Sans CJK SC only covers Simplified Chinese. Now
detects the specific CJK language (Japanese Kana, Korean Hangul, or
Chinese Hanzi) and selects the appropriate font variant (JP/KR/SC).

Changes:
- Add detectCJKFont() that reads the source file and returns the
  correct Noto Sans CJK variant, or null for non-CJK content
- CJK font argument is only added when detectCJKFont returns non-null
- Detection order: Japanese (Kana) > Korean (Hangul) > Chinese (Hanzi)
  since Japanese also uses Kanji shared with Chinese
- Graceful fallback: if file can't be read, no CJK font is added
- Update tests to use temp files with real CJK content (11 tests total)
2026-07-02 10:23:16 +08:00
Ryo
143ade3d36 fix: add CJK font support for PDF conversion
When converting documents containing Chinese, Japanese, or Korean
characters to PDF via pandoc/xelatex, the output was blank or missing
glyphs because no CJK-capable font was installed or configured.

Changes:
- Dockerfile: Add fonts-noto-cjk and texlive-lang-chinese packages
- pandoc.ts: Pass -V CJKmainfont=Noto Sans CJK SC to pandoc when
  converting to pdf/latex, so xelatex uses a CJK-capable font
- pandoc.test.ts: Add 3 tests verifying CJK font argument is present
  for pdf/latex output and absent for other formats

Fixes #547
2026-07-02 09:55:01 +08:00
Toni Ros
52af8d5824
PDF to DOCX using LibreOffice, fixes #425 (#510)
* Fix to issue #425

* Fix to Fix error in previous fix, and adapt tests

* Fix to Fix error in previous fix, and adapt tests plus prettier

* Update tests/converters/libreoffice.test.ts

Thanks

Co-authored-by: Emrik Östling <emrik.ostling@gmail.com>

* Update src/converters/libreoffice.ts

Thanks

Co-authored-by: Emrik Östling <emrik.ostling@gmail.com>

* Update src/converters/libreoffice.ts

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: Emrik Östling <emrik.ostling@gmail.com>
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-01-29 17:20:12 +01:00
kunal763
c3f17cc5a7
feat: add VCF to CSV converter (#497) 2026-01-11 16:38:32 +01:00
Jörg Krzeslak
0521af0d52 test: fix code style issue 2025-12-14 02:57:00 +01:00
Jörg Krzeslak
826dc1062a test: add awaits to rejects and resolves 2025-12-14 02:57:00 +01:00
Jörg Krzeslak
84d7da0195 test: add tests for dasel, pandoc and vtracer 2025-12-14 02:57:00 +01:00
Jörg Krzeslak
ad000f35ba test: add libreoffice.test.ts 2025-12-14 02:57:00 +01:00
Emrik Östling
3e7e95b53c
feature: add download all file by file alongside the tar download (#415) 2025-10-07 21:27:31 +02:00
Jörg Krzeslak
d994c38219 test: fix imports after eslint config changes 2025-08-11 15:09:20 +02:00
Jörg Krzeslak
c0105889ab test: extract duplicate code into another helper 2025-08-11 13:16:31 +02:00
Jörg Krzeslak
c6006b58d2 test: add test case to libjxl.test.ts when input and output are not jxl 2025-08-11 13:16:23 +02:00
Jörg Krzeslak
178f009458 test: extend fail test with different error messages 2025-08-11 13:16:17 +02:00
Jörg Krzeslak
9c24cf4aba test: add test case to ffmpeg.test.ts 2025-08-11 13:16:11 +02:00
Jörg Krzeslak
af68498494 test: change order of parameters in ExecFileFn type 2025-08-11 13:16:05 +02:00
Jörg Krzeslak
eac22d53d3 test: prettify test for msgconvert.ts 2025-08-11 13:15:59 +02:00
Jörg Krzeslak
e5ac60c187 test: add unit test for msgconvert.ts 2025-08-11 13:15:52 +02:00
Jörg Krzeslak
4b42a5fbda test: add test if stderror and stdout get logged if both are present 2025-08-11 13:15:46 +02:00
Jörg Krzeslak
08a833f1cf test: add parameter options to usage of type ExecFileFn 2025-08-11 13:15:39 +02:00
Jörg Krzeslak
6452d0b357 test: add unit test for xelatex.ts 2025-08-11 13:15:23 +02:00
Jörg Krzeslak
9f6b815197 test: add unit test for vips.ts 2025-08-11 13:15:16 +02:00
Jörg Krzeslak
d8cbc0aaee test: add unit test for resvg.ts 2025-08-11 13:15:08 +02:00
Jörg Krzeslak
b1f70ec36c test: add unit test for potrace.ts 2025-08-11 13:15:02 +02:00
Jörg Krzeslak
311d2516ce test: add unit test for libjxl.ts 2025-08-11 13:14:55 +02:00
Jörg Krzeslak
5957873534 test: add unit test for libheif.ts 2025-08-11 13:14:48 +02:00
Jörg Krzeslak
7524f304fe test: add unit test for inkscape.ts 2025-08-11 13:14:39 +02:00
Jörg Krzeslak
f1730ede97 test: add unit test for imagemagick.ts 2025-08-11 13:14:30 +02:00
Jörg Krzeslak
7f9c8868fd test: add unit test for graphicsmagick.ts 2025-08-11 13:14:23 +02:00
Jörg Krzeslak
72b484a480 test: add unit test for ffmpeg.ts 2025-08-11 13:14:14 +02:00
Jörg Krzeslak
c47c1dd4f4 test: add unit test for dvisvgm.ts 2025-08-11 13:14:06 +02:00
Jörg Krzeslak
3975c70de7 test: move converters test helper to avoid confusion 2025-08-11 13:13:58 +02:00
Jörg Krzeslak
fd4e73e76c test: add unit test for calibre.ts 2025-08-11 13:13:49 +02:00
Jörg Krzeslak
301fab5c17 test: fix import in test 2025-08-11 13:13:30 +02:00
Jörg Krzeslak
2db99edeaf test: move test file into separate subfolder 2025-08-11 13:13:07 +02:00