X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=scripts%2Ffrontfilter.pl;fp=scripts%2Ffrontfilter.pl;h=61b0184e7f95793b9666c3870bb8d65b79bb3586;hp=0000000000000000000000000000000000000000;hb=c560b69a3029efc08efe83f4672c98680dd2a605;hpb=20c4bc96a6f08ee9d2dadd0acd177cb69755eacf diff --git a/scripts/frontfilter.pl b/scripts/frontfilter.pl new file mode 100755 index 0000000..61b0184 --- /dev/null +++ b/scripts/frontfilter.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +while( $ARGV[ 0 ] ) { + $infile = shift @ARGV; + + @lines = ( ); + open( INFILE, "<$infile" ) or die "Bad input file \"$infile.\": $!"; + @lines = ; + close INFILE; + + foreach $line (@lines) { + my $oldline = $line; + $line =~ s/(\.\.\.|\.\s\.\s\.)/\&ellips\;/g; + $line =~ tr/\t/ /; + $line =~ s/\s{2,}/ /g; + $line =~ s/\&\s/\&\; /g; + $line =~ tr/\"\`\222\221/\'/; + $line =~ s/(Random\sNumber\sTable)/$1<\/a>/gi; + $line =~ s/(COMBAT\sSKILL|CLOSE\sCOMBAT\sSKILL|ENDURANCE|WILLPOWER|\bCS\b|\bEP\b)([^<])/$1<\/typ>$2/g; + $line =~ s/(Action\sCharts?)/$1<\/a>/gi; + # \222 and \221 are some form of funky right and + # left quotes not present in ascii (of course) + $line =~ tr/\227/-/; + # \227 is an em or en dash + + $line =~ s/^\s*(.*)\s*$/$1\n/; + } + + print @lines; +}