--- test/html-webhacc/cc.cgi 2007/09/10 12:09:34 1.20
+++ test/html-webhacc/cc.cgi 2008/03/16 11:38:47 1.41
@@ -1,5 +1,6 @@
#!/usr/bin/perl
use strict;
+use utf8;
use lib qw[/home/httpd/html/www/markup/html/whatpm
/home/wakaba/work/manakai2/lib];
@@ -19,6 +20,11 @@
return $s;
} # htescape
+ my @nav;
+ my %time;
+ require Message::DOM::DOMImplementation;
+ my $dom = Message::DOM::DOMImplementation->new;
+{
use Message::CGI::HTTP;
my $http = Message::CGI::HTTP->new;
@@ -30,12 +36,8 @@
binmode STDOUT, ':utf8';
$| = 1;
- require Message::DOM::DOMImplementation;
- my $dom = Message::DOM::DOMImplementation->new;
-
load_text_catalog ('en'); ## TODO: conneg
- my @nav;
print STDOUT qq[Content-Type: text/html; charset=utf-8
@@ -51,9 +53,7 @@
$| = 0;
my $input = get_input_document ($http, $dom);
- my $inner_html_element = $http->get_parameter ('e');
my $char_length = 0;
- my %time;
print qq[
@@ -61,7 +61,12 @@
Request URI
<@{[htescape $input->{request_uri}]}>
Document URI
-
<@{[htescape $input->{uri}]}>
+
<@{[htescape $input->{uri}]}>
+
]; # no yet
push @nav, ['#document-info' => 'Information'];
@@ -73,7 +78,7 @@
<@{[htescape $input->{base_uri}]}>
Internet Media Type
@{[htescape $input->{media_type}]}
- @{[$input->{media_type_overridden} ? '(overridden)' : '']}
+ @{[$input->{media_type_overridden} ? '
(overridden)' : defined $input->{official_type} ? $input->{media_type} eq $input->{official_type} ? '' : '
(sniffed; official type is: '.htescape ($input->{official_type}).'
)' : '(sniffed)']}
Character Encoding
@{[defined $input->{charset} ? ''.htescape ($input->{charset}).'
' : '(none)']}
@{[$input->{charset_overridden} ? '(overridden)' : '']}
@@ -81,41 +86,14 @@
$char_length byte@{[$char_length == 1 ? '' : 's']}
+
+
];
+ $input->{id_prefix} = '';
+ #$input->{nested} = 0;
my $result = {conforming_min => 1, conforming_max => 1};
- print_http_header_section ($input, $result);
-
- my $doc;
- my $el;
-
- if ($input->{media_type} eq 'text/html') {
- ($doc, $el) = print_syntax_error_html_section ($input, $result);
- print_source_string_section (\($input->{s}), $input->{charset});
- } elsif ({
- 'text/xml' => 1,
- 'application/atom+xml' => 1,
- 'application/rss+xml' => 1,
- 'application/svg+xml' => 1,
- 'application/xhtml+xml' => 1,
- 'application/xml' => 1,
- }->{$input->{media_type}}) {
- ($doc, $el) = print_syntax_error_xml_section ($input, $result);
- print_source_string_section (\($input->{s}), $doc->input_encoding);
- } else {
- ## TODO: Change HTTP status code??
- print_result_unknown_type_section ($input);
- }
-
- if (defined $doc or defined $el) {
- print_structure_dump_section ($doc, $el);
- my $elements = print_structure_error_section ($doc, $el, $result);
- print_table_section ($elements->{table}) if @{$elements->{table}};
- print_id_section ($elements->{id}) if keys %{$elements->{id}};
- print_term_section ($elements->{term}) if keys %{$elements->{term}};
- print_class_section ($elements->{class}) if keys %{$elements->{class}};
- }
-
+ check_and_print ($input => $result);
print_result_section ($result);
} else {
print STDOUT qq[];
@@ -134,13 +112,15 @@