- From: Mercurial notifier <nobody@w3.org>
- Date: Thu, 17 Mar 2011 21:39:31 +0000
- To: markup-validator updates <www-validator-cvs@w3.org>
changeset: 3225:fabaca0169b8
tag: tip
user: Ville Skyttä <ville.skytta@iki.fi>
date: Thu Mar 17 23:38:37 2011 +0200
files: httpd/cgi-bin/check
description:
Work around XML::LibXML "max column = 80" issue.
http://rt.cpan.org/Public/Bug/Display.html?id=66642
diff -r 2f259721acb4 -r fabaca0169b8 httpd/cgi-bin/check
--- a/httpd/cgi-bin/check Thu Mar 17 21:43:43 2011 +0200
+++ b/httpd/cgi-bin/check Thu Mar 17 23:38:37 2011 +0200
@@ -1331,6 +1331,25 @@
$err->{type} = "E";
$err->{msg} = $err_obj->message();
+ # Ugly workaround for XML::LibXML reporting column 80 when the
+ # error occurs beyond that:
+ # http://rt.cpan.org/Public/Bug/Display.html?id=66642
+ if ($err->{char} && $err->{char} == 80 &&
+ # This workaround does not apply to non-document errors, i.e.
+ # ones that have $err->{uri}.
+ !$err->{uri} && $err->{line})
+ {
+ # Get context reported by XML::LibXML, ...
+ my $ctx = $err_obj->context();
+ if ($ctx && length($ctx) == $err->{char}) {
+ # ... try to locate it in our original source line, ...
+ my $line = $File->{Content}->[$err->{line}-1] || '';
+ my $ix = index($line, $ctx);
+ # ... and adjust column offset accordingly.
+ $err->{char} += $ix if $ix > 0;
+ }
+ }
+
$err_obj = $err_obj->_prev();
unshift(@{$File->{WF_Errors}}, $err);
Received on Thursday, 17 March 2011 21:39:33 UTC