#!/usr/bin/perl
open(FP, "sr.txt");
@buffer=();
$maxFJ = 0;
while(<FP>){
chomp();
while(/^ *\t/){
s/\t/ /;
}
if(/\S\s{2,}\S/){
s/(\S)\s{2,}/$1\|/g;
if(length($_) > $maxFJ){
$maxFJ = length($_);
}
}
push(@buffer, $_);
}
# print "$maxFJ\n";
$maxFJsmaller = $maxFJ - 14;
for($x=0; $x<$maxFJ; $x++){
$separ .= "=";
}
$separ .= "\n";
foreach $line (@buffer){
#print "$separ";
# determine indent
$prefix='';
if($line =~ /^(\s*)\S/){
$prefix = $1;
}
if($line =~ /(.*)\|(.*)/){
$midPad=' ';
for($x = length($line); $x < $maxFJ; $x++){
$midPad .= ' ';
}
$line = "$1$midPad$2";
}else{
# word wrap
while($line =~ s/(.{$maxFJsmaller}[^\s]*)\s(\s*)/$prefix$2/){
print "$1\n";
}
}
print "$line\n";
}
Monday, November 23, 2009
Convert a resume to a fixed width mono space font
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment