/[suikacvs]/test/html-webhacc/WebHACC/Language/CacheManifest.pm
Suika

Contents of /test/html-webhacc/WebHACC/Language/CacheManifest.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Jul 20 16:53:10 2008 UTC (16 years, 11 months ago) by wakaba
Branch: MAIN
Changes since 1.1: +4 -21 lines
++ ChangeLog	20 Jul 2008 16:48:51 -0000
2008-07-21  Wakaba  <wakaba@suika.fam.cx>

	* cc.cgi: Errors and results are now handled by WebHACC::Result.
	Decode |uri| parameter as UTF-8.  HTTP header dump and
	input error are now handled by WebHACC::Input.

++ html/WebHACC/Language/ChangeLog	20 Jul 2008 16:53:06 -0000
2008-07-21  Wakaba  <wakaba@suika.fam.cx>

	* Base.pm (_get_cc_url, _encode_url_component): Remove (now
	supported by WebHACC::Output).

	* CSS.pm, CacheManifest.pm, DOM.pm, Default.pm,
	HTML.pm, WebIDL.pm, XML.pm: Error reporting is now delegated to
	WebHACC::Result.

++ html/WebHACC/ChangeLog	20 Jul 2008 16:50:41 -0000
2008-07-21  Wakaba  <wakaba@suika.fam.cx>

	* Input.pm (generate_transfer_sections, generate_http_header_section):
	New (partially comes from cc.cgi).

	* Output.pm (link): Call |start_tag| such that attributes
	can be set.
	(link_to_webhacc): New.
	(encode_url_component): From WebHACC::Language::Base.

	* Result.pm: Support for error outputting and result table
	generation.

1 package WebHACC::Language::CacheManifest;
2 use strict;
3 require WebHACC::Language::Base;
4 push our @ISA, 'WebHACC::Langauge::Base';
5
6 sub new ($) {
7 my $self = bless {}, shift;
8 return $self;
9 } # new
10
11 sub generate_syntax_error_section ($) {
12 my $self = shift;
13
14 require Whatpm::CacheManifest;
15
16 my $out = $self->output;
17
18 $out->start_section (id => 'parse-errors', title => 'Parse Errors');
19 $out->start_tag ('dl', id => 'parse-errors-list');
20
21 my $input = $self->input;
22 my $result = $self->result;
23
24 my $m = $input->{is_char_string} ? 'parse_char_string' : 'parse_byte_string';
25 $self->{structure} = Whatpm::CacheManifest->$m
26 ($input->{s}, $input->{uri}, $input->{base_uri}, sub {
27 $result->add_error (@_, layer => 'syntax', index_has_link => 1);
28 });
29
30 $out->end_tag ('dl');
31 $out->end_section;
32 } # generate_syntax_error_section
33
34 sub generate_structure_dump_section ($) {
35 my $self = shift;
36 my $manifest = $self->{structure};
37
38 $self->start_section (id => 'dump-manifest', title => 'Cache Manifest');
39
40 $self->html (qq[<dl><dt>Explicit entries</dt>]);
41 my $i = 0;
42 for my $uri (@{$manifest->[0]}) {
43 $out->start_tag ('dd', id => 'index-' . $i++);
44 $out->url ($uri);
45 }
46
47 $out->html (qq[<dt>Fallback entries</dt><dd>
48 <table><thead><tr><th scope=row>Oppotunistic Caching Namespace</th>
49 <th scope=row>Fallback Entry</tr><tbody>]);
50 for my $uri (sort {$a cmp $b} keys %{$manifest->[1]}) {
51 $out->start_tag ('tr');
52
53 $out->start_tag ('td', id => 'index-' . $i++);
54 $out->url ($uri);
55
56 $out->start_tag ('td', id => 'index-' . $i++);
57 $out->url ($manifest->[1]->{$uri});
58 }
59
60 $out->html (qq[</table><dt>Online whitelist</dt>]);
61 for my $uri (@{$manifest->[2]}) {
62 $out->start_tag ('dd', id => 'index-' . $i++);
63 $out->url ($uri);
64 }
65
66 $out->end_section;
67 } # generate_structure_dump_section
68
69 sub generate_structure_error_section ($) {
70 my $self = shift;
71
72 my $out = $self->output;
73
74 $out->start_section (id => 'document-errors', title => 'Document Errors');
75 $out->start_tag ('dl');
76
77 my $result = $out->result;
78
79 Whatpm::CacheManifest->check_manifest ($self->{structure}, sub {
80 $result->add_error (@_, layer => 'structure');
81 });
82
83 $out->end_section;
84 } # generate_structure_error_section
85
86 sub source_charset ($) {
87 return 'utf-8';
88 } # source_charset
89
90 1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24