Here's a simple PERL script that converts a code file for pasting into Blogger. And yes, I used it to convert itself for this post. HOW COOL IS THAT??? LOL. If anyone knows of a free, online one that's better, lemme know.
pastable.pl
if (@ARGV < 1){
die "Usage filename\n";
}
$filename = shift(@ARGV);
@fn = split(/\./,$filename);
$outname = $fn[0]."-pastable\.html";
open (INPUT,"<$filename");
open (OUTPUT,">$outname");
print OUTPUT "<font size=-1>";
while (<INPUT>){
$line = $_;
$line =~ s/\&/&/g;
$line =~ s/</</g;
$line =~ s/>/>/g;
$line =~ s/\"/"/g;
$line =~ s/\n/<BR>/g;
$line =~ s/\t/ /g;
$line =~ s/ / /g;
print OUTPUT $line;
}
print OUTPUT "</font>";
No comments:
Post a Comment