X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Ffrontfilter.pl;fp=common%2Fscripts%2Ffrontfilter.pl;h=138082cf7d70055140185fbad6af5c74e0520c1f;hp=0000000000000000000000000000000000000000;hb=f4bdee5083ca9a72713637e1e979aa183e06faea;hpb=97545603aea8298f1eceb604ff65085cc7adfced diff --git a/common/scripts/frontfilter.pl b/common/scripts/frontfilter.pl new file mode 100755 index 0000000..138082c --- /dev/null +++ b/common/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\.)//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; +}