Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the ' - another way' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say. - another way
Authored by: kholburn on Jun 19, '08 04:08:00AM
I tried this program and didn't like it because it quoted everything at the same level rather than maintaining the quote level of each paragraph separately.

I decided to write a perl script "" to wrap and unwrap the way I liked. Here it is. It's too long and complex to put the script up on a page. It's GPL so you can copy and adjust as you like.

The most useful commands I find are fix, +fix (increase and fix), -fix, unwrap, +unwrap.

unwrap: Sometimes I want to take a text email and convert it to html and keep the quotes but remove the wrapping. So this command unwraps the text into paragraphs with the quote marks for the original level at the start of each paragraph.

fix: In addition I discovered an interesting perl module called Text::Autoformat which can actually fix text that has been wrapped and quoted several times and has got pretty messed up. The best way to use this is by itself (fix) or increase quote level first and then run autoformat (+fix). You can read about it here.

The tarball of my script includes the perl Text::Autoformat and Text::Reform modules. You could get them instead from CPAN or using any package system:
macports :
sudo port install p5-text-autoformat
or fink :
sudo aptget install text-autoformat-pm
You use the script the same way but it has several additional commands:
increase or "+"
decrease or "-"
unwrap - unwraps the text but each para starts with the quote character.
wrap - simple wrap using the installed perl library Text::Wrap
fmt - simple wrap using the installed unix command fmt
fix - complex multi-quoted text reformat

it has a number of compound commands:
rewrap = unwrap, wrap
refmt = unwrap, fmt

You can add + or - in front of any command which does an increase or decrease then the command. This works on +unwrap, +wrap, +fmt, +fix, +rewrap, +refmt.

You can put multiple commands which will be executed in sequence. fix is best used by itself, it doesn't do well on unwrapped text so the sequence "unwrap fix" isn't much use.
You can make a symbolic link to the script with a command name an it will execute the command. Some examples are included in the tar file.

[ Reply to This | # ]