Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Cleaning Whitespace from Source Codeby zentara (Archbishop) |
on Dec 09, 2004 at 11:58 UTC ( [id://413485]=note: print w/replies, xml ) | Need Help?? |
As others have pointed out, you can only strip leading and trailing whitespace, unless you want to risk messing up the code. Do a google search for the C-C++ Beautifier HOW-TO.
It's very good. Indent and bcpp have options for specifying how much internal whitespace you want. Basically for perl use perltidy, for c use indent, for c++ use bcpp, and htmltidy for html. What I have is a little perl script that strips all leading whitespace( and possibly leading line numbers followed by zero or 1 colon(or semi-colon typo) , then I run it thru the above mentioned beautifiers. And yes, occasionally I need to manually fix something, when the thing breaks on an odd line or 2. I'm not really a human, but I play one on earth. flash japh
In Section
Seekers of Perl Wisdom
|
|