From: Bob Stayton Date: Sat, 13 Dec 2003 18:59:55 +0000 (+0000) Subject: Now parses as single string instead of separate lines X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cbff4dc65be8bf9f14b3adb5b3ecfbae82a369ea;p=docbook-dsssl Now parses as single string instead of separate lines so arbitrary xml whitespace is handled. --- diff --git a/gentext/locale/Auditlocale.pl b/gentext/locale/Auditlocale.pl index 80a88f5a9..6de40f9b4 100755 --- a/gentext/locale/Auditlocale.pl +++ b/gentext/locale/Auditlocale.pl @@ -18,87 +18,106 @@ if ( scalar(@ARGV) < 1 ) { exit 0; } +# Treat file as single line +local $/; +undef $/; + open MASTER, "; + +close MASTER; + my %mastertemplate; my @mastergentext; my @masterdingbat; my @contexts; -my %template; -while() { - if ( /(.*?)|gs ) { + my $context = $1; + my $templates = $2; + push @contexts, $context; + + while ( $templates =~ m|(.*?)|gs ) { + $mastertemplate{$context}{$1} = $2; } - if ( /; + close INPUT; + + while( $input =~ /(.*?)| ) { - $mastertemplate{$context}{$1} = $2; + while( $input =~ /) { - if ( /(.*?)| ) { - $template{$context}{$1} = $2; - } + while ( $master =~ m|(.*?)|gs ) { + my $context = $1; + my $templates = $2; + + while ( $templates =~ m|(.*?)|gs ) { + $template{$context}{$1} = $2; + } } - close INPUT; + + print "###########################################\n"; - print "### $input \n"; + print "### $inputfile \n"; print "###########################################\n"; # scan through master to see if missing in the other print "=========================== gentext \n"; foreach my $name ( @mastergentext ) { - unless ( grep /^$name$/, @gentext ) { - print "Missing gentext $name\n"; - } + unless ( grep /^$name$/, @gentext ) { + print "Missing gentext $name\n"; + } } print "=========================== dingbat \n"; foreach my $name ( @masterdingbat ) { - unless ( grep /^$name$/, @dingbat ) { - print "Missing dingbat $name\n"; - } + unless ( grep /^$name$/, @dingbat ) { + print "Missing dingbat $name\n"; + } } foreach my $context (@contexts) { - print "=========================== context $context \n"; - foreach my $name ( keys %{ $mastertemplate{$context} } ) { - unless ( $template{$context}{$name} ) { - print "Missing template $name = $mastertemplate{$context}{$name}\n"; - } - } - foreach my $name ( keys %{ $template{$context} } ) { - unless ( $mastertemplate{$context}{$name} ) { - print "Extra template not in master $name = $template{$context}{$name}\n"; - } - } + print "=========================== context $context \n"; + foreach my $name ( keys %{ $mastertemplate{$context} } ) { + unless ( $template{$context}{$name} ) { + print "Missing template $name = $mastertemplate{$context}{$name}\n"; + } + } + foreach my $name ( keys %{ $template{$context} } ) { + unless ( $mastertemplate{$context}{$name} ) { + print "Extra template not in master $name = $template{$context}{$name}\n"; + } + } } # scan through other to see if missing in master foreach my $name ( @gentext ) { - unless ( grep /^$name$/, @mastergentext ) { - print "Extra gentext not in master: $name\n"; - } + unless ( grep /^$name$/, @mastergentext ) { + print "Extra gentext not in master: $name\n"; + } } foreach my $name ( @dingbat ) { - unless ( grep /^$name$/, @masterdingbat ) { - print "Extra dingbat not in master: $name\n"; - } + unless ( grep /^$name$/, @masterdingbat ) { + print "Extra dingbat not in master: $name\n"; + } } }