epub-chinese-cleaner
Converts Chinese epub files from vertical (直排) + RTL page flow to horizontal (橫排) + LTR page flow.
What it does
- Detects whether the epub needs conversion (checks CSS
writing-modeand OPFpage-progression-direction) - Converts writing mode from
vertical-rltohorizontal-tb(including vendor prefixes) - Normalizes punctuation from vertical Unicode forms to horizontal equivalents
- Fixes page direction by removing
page-progression-direction="rtl"from OPF spine - Preserves original — outputs a new file with
_horizontalsuffix
Usage
Ask the agent to convert an epub by name or description:
- "Convert
三體.epubto horizontal layout" - "This epub has vertical text, can you make it horizontal?"
- "Check if
book.epubneeds conversion"
The agent runs:
python3 scripts/convert_horizontal.py <input.epub>
Output is <input>_horizontal.epub. The script auto-detects whether conversion is needed and uses direct manipulation by default, falling back to Calibre if direct manipulation fails.
Punctuation mapping
See references/punctuation-map.md for the full vertical → horizontal punctuation mapping.