Warn about unquoted attribute values containing [^-\.a-zA-Z0-9]

This commit is contained in:
acli 2004-02-12 18:19:17 +00:00
parent 21403fd5cc
commit 906bfbc3d6
1 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,7 @@ 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 {
@ -70,6 +71,9 @@ sub extract_attributes ($;$) {
$i += 1;
$attr{+lc($key)} = [$key, $val, $val_orig, $i];
$s = $rest;
warn "Warning: Attribute unquoted but needs quoting"
. (defined $lc? " in line $lc": '') . ": $val_orig\n"
if $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/;
}
if ($s =~ /\S/s) { # should never happen
warn "Warning: Strange attribute syntax"