--- test/html-webhacc/cc.cgi 2007/06/30 08:26:08 1.5 +++ test/html-webhacc/cc.cgi 2007/07/01 06:21:46 1.7 @@ -33,6 +33,8 @@ exit; } + load_text_catalog ('en'); ## TODO: conneg + my @nav; print STDOUT qq[Content-Type: text/html; charset=utf-8 @@ -88,13 +90,14 @@ my $onerror = sub { my (%opt) = @_; + my ($cls, $msg) = get_text ($opt{type}, $opt{level}); if ($opt{column} > 0) { - print STDOUT qq[
Line $opt{line} column $opt{column}
\n]; + print STDOUT qq[
Line $opt{line} column $opt{column}
\n]; } else { - $opt{line}--; - print STDOUT qq[
Line $opt{line}
\n]; + $opt{line} = $opt{line} - 1 || 1; + print STDOUT qq[
Line $opt{line}
\n]; } - print STDOUT qq[
@{[htescape $opt{type}]}
\n]; + print STDOUT qq[
$msg
\n]; }; $doc = $dom->create_document; @@ -133,8 +136,7 @@

Parse Errors

-
-]; +
]; push @nav, ['#parse-errors' => 'Parse Error']; my $onerror = sub { @@ -150,8 +152,7 @@ $doc = Message::DOM::XMLParserTemp->parse_byte_stream ($fh => $dom, $onerror, charset => 'utf-8'); - print STDOUT qq[ -
+ print STDOUT qq[
]; } else { @@ -182,16 +183,15 @@

Document Errors

-
-]; +
]; push @nav, ['#document-errors' => 'Document Error']; require Whatpm::ContentChecker; my $onerror = sub { my %opt = @_; - print STDOUT qq[
], - htescape get_node_path ($opt{node}), - "
\n
", htescape $opt{type}, "
\n"; + my ($cls, $msg) = get_text ($opt{type}, $opt{level}); + print STDOUT qq[
] . get_node_link ($opt{node}) . + qq[
\n
], $msg, "
\n"; }; my $elements; @@ -201,8 +201,7 @@ $elements = Whatpm::ContentChecker->check_document ($doc, $onerror); } - print STDOUT qq[ -
+ print STDOUT qq[
]; @@ -223,10 +222,8 @@ my $i = 0; for my $table_el (@{$elements->{table}}) { $i++; - print STDOUT qq[

]; - print STDOUT qq[], - htescape get_node_path ($table_el); - print STDOUT qq[

\n]; + print STDOUT qq[

] . + get_node_link ($table_el) . q[

]; my $table = Whatpm::HTMLTable->form_table ($table_el); @@ -260,6 +257,22 @@ print STDOUT qq[
]; } + + if (keys %{$elements->{term}}) { + print STDOUT qq[ +
+

Terms

+ +
+]; + for my $term (sort {$a cmp $b} keys %{$elements->{term}}) { + print STDOUT qq[
@{[htescape $term]}
]; + for (@{$elements->{term}->{$term}}) { + print STDOUT qq[
].get_node_link ($_).qq[
]; + } + } + print STDOUT qq[
]; + } } ## TODO: Show result @@ -282,12 +295,16 @@ my $s = $_[0]; my $i = 1; print STDOUT qq[
    \n]; - while ($$s =~ /\G([^\x0A]*?)\x0D?\x0A/gc) { - print STDOUT qq[
  1. ], htescape $1, "
  2. \n"; - $i++; - } - if ($$s =~ /\G([^\x0A]+)/gc) { - print STDOUT qq[
  3. ], htescape $1, "
  4. \n"; + if (length $$s) { + while ($$s =~ /\G([^\x0A]*?)\x0D?\x0A/gc) { + print STDOUT qq[
  5. ], htescape $1, "
  6. \n"; + $i++; + } + if ($$s =~ /\G([^\x0A]+)/gc) { + print STDOUT qq[
  7. ], htescape $1, "
  8. \n"; + } + } else { + print STDOUT q[
  9. ]; } print STDOUT "
"; } # print_input_string @@ -321,9 +338,11 @@ $r .= ''; } - if ($node->has_child_nodes) { + if ($child->has_child_nodes) { $r .= '
    '; - unshift @node, @{$child->child_nodes}, '
'; + unshift @node, @{$child->child_nodes}, ''; + } else { + $r .= ''; } } elsif ($nt == $child->TEXT_NODE) { $r .= qq'
  • ' . htescape ($child->data) . '
  • '; @@ -332,10 +351,14 @@ } elsif ($nt == $child->COMMENT_NODE) { $r .= qq'
  • <!--' . htescape ($child->data) . '-->
  • '; } elsif ($nt == $child->DOCUMENT_NODE) { - $r .= qq'
  • Document
  • '; + $r .= qq'
  • Document'; + $r .= qq[]; if ($child->has_child_nodes) { - $r .= '
      '; - unshift @node, @{$child->child_nodes}, '
    '; + $r .= '
      '; + unshift @node, @{$child->child_nodes}, '
  • '; } } elsif ($nt == $child->DOCUMENT_TYPE_NODE) { $r .= qq'
  • <!DOCTYPE>