/[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.8 - (hide annotations) (download)
Sun Aug 17 05:06:21 2008 UTC (16 years, 10 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +1 -1 lines
++ ChangeLog	17 Aug 2008 05:05:13 -0000
2008-08-17  Wakaba  <wakaba@suika.fam.cx>

	* cc-about.en.html: Author section added.

	* cc.cgi: |text/x-h2h| added.

++ html/WebHACC/Language/ChangeLog	17 Aug 2008 05:06:18 -0000
2008-08-17  Wakaba  <wakaba@suika.fam.cx>

	* CacheManifest.pm (generate_structure_dump_section): Support
	for broken manifest.

	* H2H.pm: New module.

++ html/WebHACC/ChangeLog	17 Aug 2008 05:05:31 -0000
2008-08-17  Wakaba  <wakaba@suika.fam.cx>

	* Output.pm: |text/x-h2h| added.

1 wakaba 1.1 package WebHACC::Language::CacheManifest;
2     use strict;
3     require WebHACC::Language::Base;
4 wakaba 1.4 push our @ISA, 'WebHACC::Language::Base';
5 wakaba 1.1
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 wakaba 1.5 $self->result->layer_uncertain ('charset');
19    
20 wakaba 1.3 $out->start_section (role => 'parse-errors');
21     $out->start_error_list (role => 'parse-errors');
22 wakaba 1.5 $self->result->layer_applicable ('syntax');
23 wakaba 1.1
24     my $input = $self->input;
25     my $result = $self->result;
26 wakaba 1.6
27     $self->result->layer_uncertain ('encode') unless $input->{is_char_string};
28 wakaba 1.1
29     my $m = $input->{is_char_string} ? 'parse_char_string' : 'parse_byte_string';
30     $self->{structure} = Whatpm::CacheManifest->$m
31 wakaba 1.7 ($input->{s}, $input->url, $input->{base_uri}, sub {
32 wakaba 1.2 $result->add_error (@_, layer => 'syntax', index_has_link => 1);
33     });
34 wakaba 1.3
35     $out->end_error_list (role => 'parse-errors');
36 wakaba 1.1 $out->end_section;
37     } # generate_syntax_error_section
38    
39     sub generate_structure_dump_section ($) {
40     my $self = shift;
41 wakaba 1.8 my $manifest = $self->{structure} || [[], {}, []]; # undef if it is not a manifest.
42 wakaba 1.1
43 wakaba 1.4 my $out = $self->output;
44    
45     $out->start_section (role => 'structure');
46 wakaba 1.1
47 wakaba 1.7 $out->start_tag ('dl');
48 wakaba 1.1 my $i = 0;
49 wakaba 1.7
50     $out->start_tag ('dt');
51     $out->nl_text ('Explicit entries');
52     if (@{$manifest->[0]}) {
53     for my $uri (@{$manifest->[0]}) {
54     $out->start_tag ('dd', id => 'index-' . $i++);
55     $out->url ($uri);
56     }
57     } else {
58     $out->start_tag ('dd', class => 'no-entry');
59     $out->nl_text ('No entry');
60 wakaba 1.1 }
61    
62 wakaba 1.7 $out->start_tag ('dt');
63     $out->nl_text ('Fallback entries');
64     if (keys %{$manifest->[1]}) {
65     $out->start_tag ('dd', class => 'manifest-fallbacks');
66     for my $uri (sort {$a cmp $b} keys %{$manifest->[1]}) {
67     $out->start_tag ('p', id => 'index-' . $i++);
68     $out->nl_text ('Opportunistic caching namespace');
69     $out->text (': ');
70     $out->url ($uri);
71    
72     $out->start_tag ('p', id => 'index-' . $i++);
73     $out->nl_text ('Fallback entry');
74     $out->text (': ');
75     $out->url ($manifest->[1]->{$uri});
76     }
77     } else {
78     $out->start_tag ('dd', class => 'no-entry');
79     $out->nl_text ('No entry');
80     }
81 wakaba 1.1
82 wakaba 1.7 $out->start_tag ('dt');
83     $out->nl_text ('Online whitelist');
84     if (@{$manifest->[2]}) {
85     for my $uri (@{$manifest->[2]}) {
86     $out->start_tag ('dd', id => 'index-' . $i++);
87     $out->url ($uri);
88     }
89     } else {
90     $out->start_tag ('dd', class => 'no-entry');
91     $out->nl_text ('No entry');
92 wakaba 1.1 }
93    
94 wakaba 1.7 $out->end_tag ('dl');
95 wakaba 1.1
96     $out->end_section;
97     } # generate_structure_dump_section
98    
99     sub generate_structure_error_section ($) {
100     my $self = shift;
101    
102     my $out = $self->output;
103    
104 wakaba 1.3 $out->start_section (role => 'structure-errors');
105     $out->start_error_list (role => 'structure-errors');
106 wakaba 1.5 $self->result->layer_applicable ('structure');
107 wakaba 1.1
108 wakaba 1.4 my $result = $self->result;
109 wakaba 1.1
110     Whatpm::CacheManifest->check_manifest ($self->{structure}, sub {
111 wakaba 1.2 $result->add_error (@_, layer => 'structure');
112 wakaba 1.1 });
113    
114 wakaba 1.3 $out->end_error_list;
115 wakaba 1.1 $out->end_section;
116     } # generate_structure_error_section
117    
118     sub source_charset ($) {
119     return 'utf-8';
120     } # source_charset
121    
122     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24