新增 tools/fix_wrap.py:修复中文 txt 小说的错误换行 - #1
Open
JasonJarvan wants to merge 2 commits into
Open
Conversation
Many txt novels hard-wrap paragraphs to keep a fixed line width, which renders poorly across readers. This tool detects paragraph/title boundaries by their full-width-space (U+3000) indentation, re-joins the hard-wrapped continuation lines, and strips the leading indentation. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…able - fix_wrap.py: strip half-width/tab/full-width indentation on every line so paragraph indents are fully removed and per-line-space layouts rejoin cleanly; detect paragraph starts by U+3000 after optional leading spaces. - reflow.py: companion tool for layouts fix_wrap can't handle — punctuation / speaker-based reflow (--drop-blank for mechanical blank lines), --strip-html for <div>-wrapped text, --mode lines for one-paragraph-per-line files. - tools/format_status.md: per-file formatting-status manifest for the corpus. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
仓库中不少 txt 小说为保持固定行宽,会在段落中间强行断行,同一段被拆成多行,在不同宽度的阅读器上显得杂乱。例如
阿里布达年代记.txt:排版规律
(U+3000)缩进 / 居中;本 PR
新增
tools/fix_wrap.py与tools/README.md:用法:
本 PR 仅新增工具脚本,不改动任何小说文件。
🤖 Generated with Claude Code