X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=scripts%2Fgbfixencoding.pl;fp=scripts%2Fgbfixencoding.pl;h=e12c2906b25874918ec97f432c1839e60b1e45db;hp=d6d91c578cd0fb9cbb9daa67846c3d377ff9c4a6;hb=f1623d036ac32a9d5c953c64d074583952b68d17;hpb=d1d523ac7a6c236e665eed7c21ef07a310f68753 diff --git a/scripts/gbfixencoding.pl b/scripts/gbfixencoding.pl index d6d91c5..e12c290 100755 --- a/scripts/gbfixencoding.pl +++ b/scripts/gbfixencoding.pl @@ -50,19 +50,19 @@ sub encodify { my $modified = $line; my $replacements = 0; - if( $modified =~ s{ ([[:space:]]) \& ([[:space:]]) }{$1\&ersand;$2}xg ) { $replacements = 1; } - if( $modified =~ s{ [[:space:]]+ - [[:space:]]+ }{\&emdash;}xg ) { $replacements = 1; } - if( $modified =~ s{ (?) }{$1\&emdash;$2}xg ) { $replacements = 1; } - if( $modified =~ s{ [[:space:]]* \227 [[:space:]]* }{\&emdash;}xg ) { $replacements = 1; } - if( $modified =~ s{ ([[:digit:]]) - ([[:digit:]]) }{$1\&endash;$2}xg ) { $replacements = 1; } - if( $modified =~ s{ [[:space:]]* \227 [[:space:]]* }{\&endash;}xg ) { $replacements = 1; } - if( $modified =~ s{ > [[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)? }{>\&lellips;}xg ) { $replacements = 1; } - if( $modified =~ s{ [[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)? }{\&ellips;}xg ) { $replacements = 1; } - if( $modified =~ s{ () \1 }{\&thinspace;}xg ) { $replacements = 1; } - if( $modified =~ s{ \' }{\&thinspace;\'}xg ) { $replacements = 1; } - if( $modified =~ s{ \' }{\'\&thinspace;}xg ) { $replacements = 1; } - if( $modified =~ s{ __+ }{\&blankline;}xg ) { $replacements = 1; } - if( $modified =~ s{\%}{\&percent;}xg ) { $replacements = 1; } + if( $modified =~ s{ ([[:space:]]) \& ([[:space:]]) }{$1$2}xg ) { $replacements = 1; } + if( $modified =~ s{ [[:space:]]+ - [[:space:]]+ }{}xg ) { $replacements = 1; } + if( $modified =~ s{ (?) }{$1$2}xg ) { $replacements = 1; } + if( $modified =~ s{ [[:space:]]* \227 [[:space:]]* }{}xg ) { $replacements = 1; } + if( $modified =~ s{ ([[:digit:]]) - ([[:digit:]]) }{$1$2}xg ) { $replacements = 1; } + if( $modified =~ s{ [[:space:]]* \227 [[:space:]]* }{}xg ) { $replacements = 1; } + if( $modified =~ s{ > [[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)? }{>}xg ) { $replacements = 1; } + if( $modified =~ s{ [[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)? }{}xg ) { $replacements = 1; } + if( $modified =~ s{ () \1 }{}xg ) { $replacements = 1; } + if( $modified =~ s{ \' }{}xg ) { $replacements = 1; } + if( $modified =~ s{ \' }{}xg ) { $replacements = 1; } + if( $modified =~ s{ __+ }{}xg ) { $replacements = 1; } + if( $modified =~ s{\%}{}xg ) { $replacements = 1; } if( $replacements ) { print "\033[2J"; @@ -96,26 +96,26 @@ sub highlight { $text =~ s{^[[:space:]]+}{}g; $text =~ s{ ([[:space:]]) \& ([[:space:]]) }{$1$start\&$stop$2}xg; - $text =~ s{(\&ersand;)}{$encodedStart$1$stop}g; - $text =~ s{(\&emdash;)}{$encodedDashStart$1$stop}g; + $text =~ s{()}{$encodedStart$1$stop}g; + $text =~ s{()}{$encodedDashStart$1$stop}g; $text =~ s{ [[:space:]] (\&) [[:space:]] }{$dashStart$1$stop}xg; $text =~ s{ ([[:space:]]+ - [[:space:]]+) }{$dashStart$1$stop}xg; $text =~ s{ (?)}{$encodedDashStart$1$stop}g; $text =~ s{ ([[:digit:]]) - ([[:digit:]]) }{$1$dashStart-$stop$2}xg; $text =~ s{ ([[:space:]]* \226 [[:space:]]*) }{$dashStart$1$stop}xg; - $text =~ s{(\&lellips;)}{$encodedStart$1$stop}g; + $text =~ s{()}{$encodedStart$1$stop}g; $text =~ s{ > ([[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)?) }{>$start$1$stop}xg; - $text =~ s{(\&ellips;)}{$encodedStart$1$stop}g; + $text =~ s{()}{$encodedStart$1$stop}g; $text =~ s{ ([[:space:]]* \. [[:space:]]* \. ([[:space:]]* \.)?) }{$start$1$stop}xg; - $text =~ s{(\&thinspace;)}{$encodedStart$1$stop}g; + $text =~ s{()}{$encodedStart$1$stop}g; $text =~ s{ ( \1) }{$start$1$stop}xg; - $text =~ s{ ( \') }{$start$1$stop}xg; - $text =~ s{ (\' ) }{$start$1$stop}xg; - $text =~ s{(\&blankline;)}{$encodedStart$1$stop}g; + $text =~ s{ ( ) }{$start$1$stop}xg; + $text =~ s{ ( ) }{$start$1$stop}xg; + $text =~ s{()}{$encodedStart$1$stop}g; $text =~ s{ (__+) }{$start$1$stop}xg; - $text =~ s{(\&percent;)}{$encodedStart$1$stop}g; + $text =~ s{()}{$encodedStart$1$stop}g; $text =~ s{(\%)}{$start$1$stop}xg; return $text;