X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Fgblint.pl;h=69cc5d11b8460c9bb695c64446b606864ecd4937;hp=0caf1b49fce103e41e54eaadf6d5256ee0e77eee;hb=0b8179f4f09736b015607ed74574d41573de39cd;hpb=94b200d4710f6ffb5e3bb7aa622fa82be39be177 diff --git a/common/scripts/gblint.pl b/common/scripts/gblint.pl index 0caf1b4..69cc5d1 100755 --- a/common/scripts/gblint.pl +++ b/common/scripts/gblint.pl @@ -174,6 +174,10 @@ while( $#ARGV > -1 && $ARGV[ 0 ] =~ /^-/ ) { shift @ARGV; $language = shift @ARGV; } + elsif( $ARGV[ 0 ] eq '-h' ) { + usage(); + exit 0; + } } my $lineNumber = 1; @@ -231,7 +235,7 @@ while( my $line = <> ) { # ellipsis if( $line =~ /(\.\s*\.(\s*\.)?)/ ) { &printError( "ne", $currentSection, $lineNumber, "possible malformed ellipsis", "$1", " or " ); } - if( $line =~ m{([[:space:]])} || $line =~ m{([[:space:]])} ) { &printError( "ne", $currentSection, $lineNumber, " with extraneous surrounding space", "$1", "" ); } + if( $line =~ m{([[:space:]])}) { &printError( "ne", $currentSection, $lineNumber, " with extraneous surrounding space", "$1", "" ); } if( $line =~ m{([^>])()} ) { &printError( "ne", $currentSection, $lineNumber, "possible used in place of ", "$1$2", "$1" ); } if( $line =~ m{(>)} ) { &printError( "ne", $currentSection, $lineNumber, "possible used in place of ", "$1", ">" ); } @@ -303,6 +307,8 @@ while( my $line = <> ) { $1 ne "COMBAT" && $1 ne "WILLPOWER" && $1 ne "HAVOC" && + $1 ne "TARGET" && + $1 ne "RESISTANCE" && $1 ne "CLOSE") || ($language eq 'es' && $1 ne 'DESTREZA' && @@ -343,3 +349,16 @@ sub printError { ++$errorCount; if( $maxErrorCount > 0 && $errorCount > $maxErrorCount ) { die "Maximum number of errors ($maxErrorCount) exceeded. Quitting.\n"; } } + +sub usage { + print "Gamebook lintian checker - reads from standard input a gamebook XML file and prints out possible errors\n\n"; + print "Usage: gblint.pl [-e ] [-s ] [-i ] [--use-corr] [--skip-ASCII-check] [--language CODE]\n"; + print "Options:\n"; + print "\t-e \tStops when NUMBER errors have been reached (by default it does not stop)\n"; + print "\t-s \tSkips NUMBER of lines before analysing\n"; + print "\t-i \tAdds TEXT to error messages (default: '??')\n"; + print "\t--use-corr\tPrints correction in report (default: disabled)\n"; + print "\t--skip-ASCII-check\tDoes not check for non-ASCCI characters (default: enabled)\n"; + print "\t--language CODE\tDefines the language of the gamebook file (default: 'en'\n"; + print "\t-h\tPrint this help and exit\n"; +}