From: acli Date: Sat, 14 Feb 2004 05:46:38 +0000 (+0000) Subject: Make sure that if an attribute contains < or >, a warning is given; these X-Git-Tag: R_2-1~603 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=93740ec7ba69a4a34f8a56e4777aad9f9ed4ad41;p=koha_gimpoz Make sure that if an attribute contains < or >, a warning is given; these warnings aren't pedantic because (1) if it's a templating directive, it might expand into something containing a real < and/or >, and (2) if it contains >, the browser will close the current tag, and (3) if it contains < and the browser knows what "SGML closed start tags" are (e.g., Mozilla), the browser will also close the current tag. --- diff --git a/misc/translator/text-extract2.pl b/misc/translator/text-extract2.pl index 77472f76f3..803d60451d 100755 --- a/misc/translator/text-extract2.pl +++ b/misc/translator/text-extract2.pl @@ -82,8 +82,10 @@ sub extract_attributes ($;$) { $s = $rest; warn "Warning: Attribute should be quoted" . (defined $lc? " near line $lc": '') . ": $val_orig\n" - if $pedantic_p - && $val =~ /[^-\.A-Za-z0-9]/s && $val_orig !~ /^['"]/; + if $val_orig !~ /^['"]/ && ( + ($pedantic_p && $val =~ /[^-\.A-Za-z0-9]/s) + || $val =~ /[<>]/s # this covers $re_directive, too + ) } if ($s =~ /\S/s) { # should never happen if ($s =~ /^([^\n]*)\n/s) { # this is even worse