X-Git-Url: http://git.projectaon.org/?p=project-aon.git;a=blobdiff_plain;f=common%2Fscripts%2Fgblint.pl;h=85e5ced376f3c945aa1c2c5c852c7a6a3f2852a6;hp=c8245031d81d005f8b7fbb8f1f1c459154b857b0;hb=195eff31df03c6416660c0095263990b1efc6675;hpb=f4bdee5083ca9a72713637e1e979aa183e06faea diff --git a/common/scripts/gblint.pl b/common/scripts/gblint.pl index c824503..85e5ced 100755 --- a/common/scripts/gblint.pl +++ b/common/scripts/gblint.pl @@ -70,6 +70,13 @@ my %sectionDocLookup = ( 'howcarry' => 'equipmnt', 'howmuch' => 'equipmnt', 'howuse' => 'equipmnt', + 'backpack' => 'equipmnt', + 'ammpouch' => 'equipmnt', + 'medikit' => 'equipmnt', + 'canteen' => 'equipmnt', + 'weapons' => 'weapons', + 'close' => 'weapons', + 'missile' => 'weapons', 'cmbtrulz' => 'cmbtrulz', 'evasion' => 'cmbtrulz', 'lorecrcl' => 'lorecrcl', @@ -167,10 +174,14 @@ while( $#ARGV > -1 && $ARGV[ 0 ] =~ /^-/ ) { shift @ARGV; $language = shift @ARGV; } + elsif( $ARGV[ 0 ] eq '-h' ) { + usage(); + exit 0; + } } my $lineNumber = 1; -my $currentSection = "_unknown"; +my $currentSection = ''; while( my $line = <> ) { my @section = ( $line =~ /]+id="([^"]*)"/g ); @@ -182,6 +193,7 @@ while( my $line = <> ) { else { $currentSection = $sectionDocLookup{$section[ 0 ]}; } + $currentSection = '_unknown' unless defined $currentSection; } if( $skipLines >= $lineNumber ) { @@ -335,3 +347,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"; +}