From 1f128d73818765642ff6c1eb5ddcfb8615d18db1 Mon Sep 17 00:00:00 2001 From: acli Date: Fri, 13 Feb 2004 01:14:18 +0000 Subject: [PATCH] Don't issue warnings for unquoted attributes containing [^-\.a-zA-Z0-9] unless --pedantic-warnings is given. These don't seem to cause any trouble, even in Mozilla's standards compliant mode. --- misc/translator/text-extract2.pl | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index b378bb4445..ee79eb02bc 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -23,6 +23,7 @@ use strict; use vars qw( $input ); use vars qw( $debug_dump_only_p ); +use vars qw( $pedantic_p ); ############################################################################### @@ -42,7 +43,6 @@ sub re_tag ($) { my $etag = $compat? '>': '<>\/'; # See the file "subst.pl.test1" for how the following mess is derived # Unfortunately, inserting $re_directive's has made this even messier - # FIXME: The following is somehow wrong. Paul's 1st report shouldn't happen. q{(<\/?(?:|(?:"(?:} . $re_directive . q{|[^"])*"|'(?:} . $re_directive . q{|[^'])*'|--(?:[^-]|-[^-])*--|(?:} . $re_directive . q{|[^-"'} . $etag . q{]|-[^-]))+))([} . $etag . q{])(.*)}; } BEGIN { @@ -81,7 +81,8 @@ sub extract_attributes ($;$) { $s = $rest; warn "Warning: Attribute should be quoted" . (defined $lc? " in line $lc": '') . ": $val_orig\n" - if $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/; + if $pedantic_p + && $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/; } if ($s =~ /\S/s) { # should never happen warn "Warning: Strange attribute syntax" @@ -248,9 +249,27 @@ sub text_extract (*) { ############################################################################### +sub usage ($) { + my($exitcode) = @_; + my $h = $exitcode? *STDERR: *STDOUT; + print $h < \$input, - 'debug-dump-only-p' => \$debug_dump_only_p, + 'f|file=s' => \$input, + 'debug-dump-only' => \$debug_dump_only_p, + 'pedantic-warnings' => sub { $pedantic_p = 1 }, + 'help' => sub { usage(0) }, ) || exit(-1); open(INPUT, "<$input") || die "$0: $input: $!\n"; -- 2.39.5