|
|
quoter.pl - another way
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 "quoter.pl" 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 :
or fink :
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. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.06 seconds |
|