Hello,
I was wondering if anyone here has a tool (preferably something that can
be run from the UNIX command line, like a perl script or C script) that
will take a text file (fanfic) as input and rewrap the lines properly. Any
suggestions on a good algorithm for doing this would also be appreciated.
There are three kinds of miswrapped lines, as far as I know:
(1) long line-short line, e.g.:
If it failed, I'd look a little silly. But if it worked... I began to
tremble a little. To have
Gourry-sama's love... that was worth the risk of looking foolish.
There were other voices from around the corner, which I ignored, just
as I ignored whatever
voice was whispering inside of me, telling me that this was wrong.
(2) lines that are wrapped to a width greater than 79, e.g.:
If it failed, I'd look a little silly. But if it worked... I began to tremble a
little. To have
Gourry-sama's love... that was worth the risk of looking foolish.
There were other voices from around the corner, which I ignored, just as I
ignored whatever
voice was whispering inside of me, telling me that this was wrong.
(3) lines that are not wrapped at all, e.g.:
If it failed, I'd look a little silly. But if it worked... I began to tremble a
little. To have Gourry-sama's love... that was worth the risk of looking
foolish.
There were other voices from around the corner, which I ignored, just as I
ignored whatever voice was whispering inside of me, telling me that this was
wrong.
---
I realize that such a tool exists at the autoresponder
cleanup@thekeep.org. The problem I found with that program is that it
relies on there being a blank line between each paragraph. This will not
work for me, because I am looking to create a tool that I can apply to a
whole archive of fanfics without having to supervise it. Not all fanfics
have blank lines between paragraphs (e.g. some use tabs instead), and
things like
======================================================================
The Koi on Her Breast
by Philip Mak
======================================================================
could end up as
======================================================================
The Koi on Her Breast by Philip Mak
======================================================================
when wrapped in this fashion.
Please send responses privately to me at pmak@aaanime.net.
Of course, I will post a link to the tool for everyone's benefit when I
have it finished.
Thanks,
-Philip Mak (pmak@aaanime.net)