/[suikacvs]/test/html-webhacc/cc.cgi
Suika

Contents of /test/html-webhacc/cc.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.68 - (show annotations) (download)
Wed Sep 17 03:56:43 2008 UTC (16 years, 2 months ago) by wakaba
Branch: MAIN
Changes since 1.67: +2 -1 lines
++ ChangeLog	17 Sep 2008 03:55:55 -0000
2008-09-17  Wakaba  <wakaba@suika.fam.cx>

	* cc.cgi: Support for |text/x-css-inline| type is added.

2008-09-17  Wakaba  <wakaba@suika.fam.cx>

	* standards.en.html: Updated.

++ html/WebHACC/Language/ChangeLog	17 Sep 2008 03:56:41 -0000
2008-09-17  Wakaba  <wakaba@suika.fam.cx>

	* CSSInline.pm: New module.

++ html/WebHACC/ChangeLog	17 Sep 2008 03:56:25 -0000
2008-09-17  Wakaba  <wakaba@suika.fam.cx>

	* Output.pm: Support for the |text/x-css-inline| type is added.

1 #!/usr/bin/perl
2 # -d:DProf
3 use strict;
4
5 use lib qw[/home/httpd/html/www/markup/html/whatpm
6 /home/wakaba/work/manakai2/lib];
7 use CGI::Carp qw[fatalsToBrowser];
8
9 require WebHACC::Input;
10
11 {
12 require Message::CGI::HTTP;
13 my $http = Message::CGI::HTTP->new;
14
15 require WebHACC::Output;
16 my $out = WebHACC::Output->new;
17 $out->handle (*STDOUT);
18 $out->set_utf8;
19
20 if ($http->get_meta_variable ('PATH_INFO') ne '/') {
21 $out->http_error (404);
22 exit;
23 }
24
25 ## TODO: We need real conneg support...
26 my $primary_language = 'en';
27 if ($ENV{HTTP_ACCEPT_LANGUAGE} =~ /ja/) {
28 $primary_language = 'ja';
29 }
30 $out->load_text_catalog ($primary_language);
31
32 $out->set_flush;
33 $out->http_header;
34 $out->html_header;
35 $out->unset_flush;
36
37 $out->generate_input_section ($http);
38
39 my $u = $http->get_parameter ('uri');
40 my $s = $http->get_parameter ('s');
41 if ((not defined $u or not length $u) and
42 (not defined $s or not length $s)) {
43 exit;
44 }
45
46 require WebHACC::Result;
47 my $result = WebHACC::Result->new;
48 $result->output ($out);
49
50 require WebHACC::Input;
51 my $input = WebHACC::Input->get_document ($http => $result => $out);
52
53 check_and_print ($input => $result => $out);
54
55 $out->nav_list;
56
57 exit;
58 }
59
60 sub check_and_print ($$$) {
61 my ($input, $result, $out) = @_;
62 my $original_input = $out->input;
63 $out->input ($input);
64
65 $input->generate_info_section ($result);
66
67 $input->generate_transfer_sections ($result);
68
69 unless (defined $input->{s}) {
70 ## NOTE: This is an error of the implementation.
71 $result->layer_uncertain ('transfer');
72 $result->generate_result_section;
73
74 $out->input ($original_input);
75 return;
76 }
77
78 my $checker_class = {
79 'text/cache-manifest' => 'WebHACC::Language::CacheManifest',
80 'text/css' => 'WebHACC::Language::CSS',
81 'text/x-css-inline' => 'WebHACC::Language::CSSInline',
82 'text/html' => 'WebHACC::Language::HTML',
83 'text/x-h2h' => 'WebHACC::Language::H2H',
84 'text/x-webidl' => 'WebHACC::Language::WebIDL',
85
86 'text/xml' => 'WebHACC::Language::XML',
87 'application/atom+xml' => 'WebHACC::Language::XML',
88 'application/rss+xml' => 'WebHACC::Language::XML',
89 'image/svg+xml' => 'WebHACC::Language::XML',
90 'application/xhtml+xml' => 'WebHACC::Language::XML',
91 'application/xml' => 'WebHACC::Language::XML',
92 ## TODO: Should we make all XML MIME Types fall
93 ## into this category?
94
95 ## NOTE: This type has different model from normal XML types.
96 'application/rdf+xml' => 'WebHACC::Language::XML',
97 }->{$input->{media_type}} || 'WebHACC::Language::Default';
98
99 eval qq{ require $checker_class } or die "$0: Loading $checker_class: $@";
100 my $checker = $checker_class->new;
101 $checker->input ($input);
102 $checker->output ($out);
103 $checker->result ($result);
104
105 ## TODO: A cache manifest MUST be text/cache-manifest
106 ## TODO: WebIDL media type "text/x-webidl"
107
108 $checker->generate_syntax_error_section;
109 $checker->generate_source_string_section;
110
111 my @subdoc;
112 $checker->onsubdoc (sub {
113 push @subdoc, shift;
114 });
115
116 $checker->generate_structure_dump_section;
117 $checker->generate_structure_error_section;
118 $checker->generate_additional_sections;
119
120 my $id_prefix = 0;
121 for my $_subinput (@subdoc) {
122 my $subinput = WebHACC::Input::Subdocument->new (++$id_prefix);
123 $subinput->{$_} = $_subinput->{$_} for keys %$_subinput;
124 $subinput->{base_uri} = $subinput->{container_node}->base_uri
125 unless defined $subinput->{base_uri};
126 $subinput->{parent_input} = $input;
127
128 my $subresult = WebHACC::Result->new;
129 $subresult->output ($out);
130 $subresult->parent_result ($result);
131
132 $subinput->start_section ($subresult);
133 check_and_print ($subinput => $subresult => $out);
134 $subinput->end_section ($subresult);
135 }
136
137 $result->generate_result_section;
138
139 $out->input ($original_input);
140 } # check_and_print
141
142 =head1 AUTHOR
143
144 Wakaba <w@suika.fam.cx>.
145
146 =head1 LICENSE
147
148 Copyright 2007-2008 Wakaba <w@suika.fam.cx>
149
150 This library is free software; you can redistribute it
151 and/or modify it under the same terms as Perl itself.
152
153 =cut
154
155 ## $Date: 2008/09/15 14:34:58 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24