--- test/html-webhacc/cc.cgi 2008/02/24 02:17:51 1.37 +++ test/html-webhacc/cc.cgi 2008/03/17 13:52:48 1.44 @@ -86,6 +86,8 @@
$char_length byte@{[$char_length == 1 ? '' : 's']}
+ + ]; $input->{id_prefix} = ''; @@ -292,18 +294,14 @@

Parse Errors

-
]; +
]; push @nav, ['#parse-errors' => 'Parse Error'] unless $input->{nested}; my $onerror = sub { my (%opt) = @_; my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level}); - if ($opt{column} > 0) { - print STDOUT qq[
Line $opt{line} column $opt{column}
\n]; - } else { - $opt{line} = $opt{line} - 1 || 1; - print STDOUT qq[
Line $opt{line}
\n]; - } + print STDOUT qq[
], get_error_label ($input, \%opt), + qq[
]; $type =~ tr/ /-/; $type =~ s/\|/%7C/g; $msg .= qq[ [Description]]; @@ -350,7 +348,7 @@

Parse Errors

-
]; +
]; push @nav, ['#parse-errors' => 'Parse Error'] unless $input->{prefix}; my $onerror = sub { @@ -561,7 +559,7 @@

Parse Errors

-
]; +
]; push @nav, ['#parse-errors' => 'Parse Error'] unless $input->{nested}; my $p = get_css_parser (); @@ -627,7 +625,7 @@

Parse Errors

-
]; +
]; push @nav, ['#parse-errors' => 'Parse Error'] unless $input->{nested}; my $onerror = sub { @@ -673,19 +671,22 @@

Document Source

    \n]; if (length $$s) { - while ($$s =~ /\G([^\x0A]*?)\x0D?\x0A/gc) { + while ($$s =~ /\G([^\x0D\x0A]*?)(?>\x0D\x0A?|\x0A)/gc) { print STDOUT qq[
  1. ], htescape $1, "
  2. \n"; $i++; } - if ($$s =~ /\G([^\x0A]+)/gc) { + if ($$s =~ /\G([^\x0D\x0A]+)/gc) { print STDOUT qq[
  3. ], htescape $1, "
  4. \n"; } } else { print STDOUT q[
  5. ]; } - print STDOUT "
"; + print STDOUT "
+"; } # print_input_string_section sub print_document_tree ($$) { @@ -854,7 +855,7 @@ print STDOUT qq[

Document Errors

-
]; +
]; push @nav, [qq[#$input->{id_prefix}document-errors] => 'Document Error'] unless $input->{nested}; @@ -882,7 +883,10 @@ } $time{check} = time - $time1; - print STDOUT qq[
]; + print STDOUT qq[
+
]; return $elements; } # print_structure_error_dom_section @@ -1122,18 +1126,49 @@ my $r = ''; - if (defined $err->{line}) { - if ($err->{column} > 0) { - $r = qq[Line $err->{line} column $err->{column}]; + my $line; + my $column; + + if (defined $err->{node}) { + $line = $err->{node}->get_user_data ('manakai_source_line'); + if (defined $line) { + $column = $err->{node}->get_user_data ('manakai_source_column'); + } else { + if ($err->{node}->node_type == $err->{node}->ATTRIBUTE_NODE) { + my $owner = $err->{node}->owner_element; + $line = $owner->get_user_data ('manakai_source_line'); + $column = $owner->get_user_data ('manakai_source_column'); + } else { + my $parent = $err->{node}->parent_node; + if ($parent) { + $line = $parent->get_user_data ('manakai_source_line'); + $column = $parent->get_user_data ('manakai_source_column'); + } + } + } + } + unless (defined $line) { + if (defined $err->{token} and defined $err->{token}->{line}) { + $line = $err->{token}->{line}; + $column = $err->{token}->{column}; + } elsif (defined $err->{line}) { + $line = $err->{line}; + $column = $err->{column}; + } + } + + if (defined $line) { + if (defined $column and $column > 0) { + $r = qq[Line $line column $column]; } else { - $err->{line} = $err->{line} - 1 || 1; - $r = qq[Line $err->{line}]; + $line = $line - 1 || 1; + $r = qq[Line $line]; } } if (defined $err->{node}) { $r .= ' ' if length $r; - $r = get_node_link ($input, $err->{node}); + $r .= get_node_link ($input, $err->{node}); } if (defined $err->{index}) { @@ -1457,4 +1492,4 @@ =cut -## $Date: 2008/02/24 02:17:51 $ +## $Date: 2008/03/17 13:52:48 $