X-Git-Url: http://git.projectaon.org/?a=blobdiff_plain;f=scripts%2Fgblint.pl;h=2a98dc26cb6df086822b861a021466a576444755;hb=adadc9eb344b84ccecc8319d11234847e0efc092;hp=faaa8aac4fdff744d2d442f0aa1a15b63acd0f0a;hpb=c560b69a3029efc08efe83f4672c98680dd2a605;p=project-aon.git diff --git a/scripts/gblint.pl b/scripts/gblint.pl index faaa8aa..2a98dc2 100755 --- a/scripts/gblint.pl +++ b/scripts/gblint.pl @@ -139,6 +139,8 @@ my $maxErrorCount = 0; my $skipLines = 0; my $initials = "??"; my $useCorr = 0; +my $checkNonASCII = 1; +my $language = 'en'; while( $#ARGV > -1 && $ARGV[ 0 ] =~ /^-/ ) { if( $ARGV[ 0 ] eq "-e" && $#ARGV > 0 ) { @@ -157,6 +159,14 @@ while( $#ARGV > -1 && $ARGV[ 0 ] =~ /^-/ ) { shift @ARGV; $useCorr = 1; } + elsif( $ARGV[ 0 ] eq '--skip-ASCII-check' ) { + shift @ARGV; + $checkNonASCII = 0; + } + elsif( $ARGV[ 0 ] eq '--language' ) { + shift @ARGV; + $language = shift @ARGV; + } } my $lineNumber = 1; @@ -187,8 +197,11 @@ while( my $line = <> ) { if( $line =~ /\224/ ) { &printError( "ne", $currentSection, $lineNumber, "unescaped right double quotation mark(s)", "\224", "..." ); } if( $line =~ /\226/ ) { &printError( "ne", $currentSection, $lineNumber, "unescaped endash(es)", "\226", "&endash;" ); } if( $line =~ /\227/ ) { &printError( "ne", $currentSection, $lineNumber, "unescaped emdash(es)", "\227", "&emdash;" ); } - if( $line =~ /([ \200-\220 \225 \230-\377 ])/gx ) { - &printError( "ne", $currentSection, $lineNumber, "unescaped non-ASCII character(s); first found only", "$1" ); +# if( $checkNonASCII && $line =~ /(.{0,4}?)?([\x80-\xff])(.{0,4})?/ ) { +# &printError( "ne", $currentSection, $lineNumber, "unescaped non-ASCII character(s) in \"${1}[[HERE]]${3}\"; first found only", "$2" ); +# } + if( $line =~ /(.{0,4}?)?([\x80-\x9f])(.{0,4})?/ ) { + &printError( "ne", $currentSection, $lineNumber, "unsafe non-ASCII character(s) in \"${1}[[HERE]]${3}\"; first found only", "$2" ); } } if( $line =~ /'/ ) { &printError( "ne", $currentSection, $lineNumber, "unescaped apostrophe(s)", "'", "\' or ..." ); } @@ -246,7 +259,7 @@ while( my $line = <> ) { if( $line =~ /(\&link.[^;]+;)/ ) { &printError( "ne", $currentSection, $lineNumber, "probable obsolete markup", "$1", "use instead" ); } if( $line =~ /\&([^[:space:]]+);/ ) { unless( $1 =~ /^(?:link|inclusion)/ ) { - &printError( "ne", $currentSection, $lineNumber, "probable obsolete markup", "\&$1\;", "" ); + &printError( "ne", $currentSection, $lineNumber, "possible obsolete markup", "\&$1\;", "" ); } } if( $line =~ /(]*) class="footnote"(.*?)>)/ ) { &printError( "ne", $currentSection, $lineNumber, "obsolete markup", "$1", "" ); } @@ -273,15 +286,20 @@ while( my $line = <> ) { ##### Others if( $line =~ m{