--- test/html-webhacc/cc.cgi 2008/02/24 02:17:51 1.37
+++ test/html-webhacc/cc.cgi 2008/07/18 14:44:16 1.52
@@ -86,6 +86,8 @@
$char_length byte@{[$char_length == 1 ? '' : 's']}
+
+
];
$input->{id_prefix} = '';
@@ -159,6 +161,7 @@
my $el;
my $cssom;
my $manifest;
+ my $idl;
my @subdoc;
if ($input->{media_type} eq 'text/html') {
@@ -171,9 +174,13 @@
'text/xml' => 1,
'application/atom+xml' => 1,
'application/rss+xml' => 1,
- 'application/svg+xml' => 1,
+ 'image/svg+xml' => 1,
'application/xhtml+xml' => 1,
'application/xml' => 1,
+ ## TODO: Should we make all XML MIME Types fall
+ ## into this category?
+
+ 'application/rdf+xml' => 1, ## NOTE: This type has different model.
}->{$input->{media_type}}) {
($doc, $el) = print_syntax_error_xml_section ($input, $result);
print_source_string_section ($input,
@@ -189,6 +196,10 @@
$manifest = print_syntax_error_manifest_section ($input, $result);
print_source_string_section ($input, \($input->{s}),
'utf-8');
+ } elsif ($input->{media_type} eq 'text/x-webidl') { ## TODO: type
+ $idl = print_syntax_error_webidl_section ($input, $result);
+ print_source_string_section ($input, \($input->{s}),
+ 'utf-8'); ## TODO: charset
} else {
## TODO: Change HTTP status code??
print_result_unknown_type_section ($input, $result);
@@ -212,6 +223,8 @@
print_listing_section ({
id => 'classes', label => 'Classes', heading => 'Classes',
}, $input, $elements->{class}) if keys %{$elements->{class}};
+ print_uri_section ($input, $elements->{uri}) if keys %{$elements->{uri}};
+ print_rdf_section ($input, $elements->{rdf}) if @{$elements->{rdf}};
} elsif (defined $cssom) {
print_structure_dump_cssom_section ($input, $cssom);
## TODO: CSSOM validation
@@ -219,6 +232,9 @@
} elsif (defined $manifest) {
print_structure_dump_manifest_section ($input, $manifest);
print_structure_error_manifest_section ($input, $manifest, $result);
+ } elsif (defined $idl) {
+ print_structure_dump_webidl_section ($input, $idl);
+ print_structure_error_webidl_section ($input, $idl, $result);
}
my $id_prefix = 0;
@@ -292,18 +308,14 @@
];
return $elements;
} # print_structure_error_dom_section
@@ -912,6 +1015,21 @@
print STDOUT qq[];
} # print_structure_error_manifest_section
+sub print_structure_error_webidl_section ($$$) {
+ my ($input, $idl, $result) = @_;
+
+ print STDOUT qq[];
+} # print_structure_error_webidl_section
+
sub print_table_section ($$) {
my ($input, $tables) = @_;
@@ -931,16 +1049,15 @@
require JSON;
my $i = 0;
- for my $table_el (@$tables) {
+ for my $table (@$tables) {
$i++;
print STDOUT qq[] .
- get_node_link ($input, $table_el) . q[
];
+ get_node_link ($input, $table->{element}) . q[];
- ## TODO: Make |ContentChecker| return |form_table| result
- ## so that this script don't have to run the algorithm twice.
- my $table = Whatpm::HTMLTable->form_table ($table_el);
-
- for (@{$table->{column_group}}, @{$table->{column}}, $table->{caption}) {
+ delete $table->{element};
+
+ for (@{$table->{column_group}}, @{$table->{column}}, $table->{caption},
+ @{$table->{row}}) {
next unless $_;
delete $_->{element};
}
@@ -993,6 +1110,106 @@
print STDOUT qq[];
} # print_listing_section
+sub print_uri_section ($$$) {
+ my ($input, $uris) = @_;
+
+ ## NOTE: URIs contained in the DOM (i.e. in HTML or XML documents),
+ ## except for those in RDF triples.
+ ## TODO: URIs in CSS
+
+ push @nav, ['#' . $input->{id_prefix} . 'uris' => 'URIs']
+ unless $input->{nested};
+ print STDOUT qq[
+];
+} # print_uri_section
+
+sub print_rdf_section ($$$) {
+ my ($input, $rdfs) = @_;
+
+ push @nav, ['#' . $input->{id_prefix} . 'rdf' => 'RDF']
+ unless $input->{nested};
+ print STDOUT qq[
+];
+} # print_rdf_section
+
+sub get_rdf_resource_html ($) {
+ my $resource = shift;
+ if (defined $resource->{uri}) {
+ my $euri = htescape ($resource->{uri});
+ return '<' . $euri .
+ '>
';
+ } elsif (defined $resource->{bnodeid}) {
+ return htescape ('_:' . $resource->{bnodeid});
+ } elsif ($resource->{nodes}) {
+ return '(rdf:XMLLiteral)';
+ } elsif (defined $resource->{value}) {
+ my $elang = htescape (defined $resource->{language}
+ ? $resource->{language} : '');
+ my $r = qq[] . htescape ($resource->{value}) . '
';
+ if (defined $resource->{datatype}) {
+ my $euri = htescape ($resource->{datatype});
+ $r .= '^^<' . $euri .
+ '>
';
+ } elsif (length $resource->{language}) {
+ $r .= '@' . htescape ($resource->{language});
+ }
+ return $r;
+ } else {
+ return '??';
+ }
+} # get_rdf_resource_html
+
sub print_result_section ($) {
my $result = shift;
@@ -1058,24 +1275,25 @@
print STDOUT qq[$label | $result->{$_->[1]}->{must}$uncertain | $result->{$_->[1]}->{should}$uncertain | $result->{$_->[1]}->{warning}$uncertain | ];
if ($uncertain) {
- print qq[−∞..$result->{$_->[1]}->{score_max} | ];
+ print qq[−∞..$result->{$_->[1]}->{score_max}];
} elsif ($result->{$_->[1]}->{score_min} != $result->{$_->[1]}->{score_max}) {
- print qq[ | $result->{$_->[1]}->{score_min}..$result->{$_->[1]}->{score_max} |
];
+ print qq[$result->{$_->[1]}->{score_min}..$result->{$_->[1]}->{score_max}];
} else {
- print qq[ | $result->{$_->[1]}->{score_min} | ];
+ print qq[$result->{$_->[1]}->{score_min}];
}
+ print qq[ / 20];
}
$score_max += $score_base;
print STDOUT qq[
- | Semantics | 0? | 0? | 0? | −∞..$score_base |
+Semantics | 0? | 0? | 0? | −∞..$score_base / 20
|
---|
Total |
$must_error? |
$should_error? |
$warning? |
-−∞..$score_max |
+−∞..$score_max / 100
Important: This conformance checking service
@@ -1122,18 +1340,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 {
- $err->{line} = $err->{line} - 1 || 1;
- $r = qq[Line $err->{line}];
+ 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 {
+ $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}) {
@@ -1187,10 +1436,10 @@
while (defined $node) {
my $rs;
if ($node->node_type == 1) {
- $rs = $node->manakai_local_name;
+ $rs = $node->node_name;
$node = $node->parent_node;
} elsif ($node->node_type == 2) {
- $rs = '@' . $node->manakai_local_name;
+ $rs = '@' . $node->node_name;
$node = $node->owner_element;
} elsif ($node->node_type == 3) {
$rs = '"' . $node->data . '"';
@@ -1268,6 +1517,17 @@
}
+sub encode_uri_component ($) {
+ require Encode;
+ my $s = Encode::encode ('utf8', shift);
+ $s =~ s/([^0-9A-Za-z_.~-])/sprintf '%%%02X', ord $1/ge;
+ return $s;
+} # encode_uri_component
+
+sub get_cc_uri ($) {
+ return './?uri=' . encode_uri_component ($_[0]);
+} # get_cc_uri
+
sub get_input_document ($$) {
my ($http, $dom) = @_;
@@ -1457,4 +1717,4 @@
=cut
-## $Date: 2008/02/24 02:17:51 $
+## $Date: 2008/07/18 14:44:16 $
|