/[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.7 - (hide annotations) (download)
Sat Aug 16 07:42:20 2008 UTC (16 years, 10 months ago) by wakaba
Branch: MAIN
Changes since 1.6: +43 -20 lines
++ ChangeLog	16 Aug 2008 07:38:01 -0000
	* cc-script.js: Support for #index- fragment identifiers.

	* cc-style.css: Prety styling for reformatted sources.
	Support for new version of manifest dump sections.

	* error-description-source.xml: Support for Whatpm::CacheManifest,
	Whatpm::CSS::SelectorsParser, Whatpm::CSS::MediaQueryParser,
	and Whatpm::CSS::Parser errors.  Support for l10n of cache
	manifest dump sections.

2008-08-16  Wakaba  <wakaba@suika.fam.cx>

++ html/WebHACC/Language/ChangeLog	16 Aug 2008 07:42:17 -0000
	* CSS.pm, CacheManifest.pm, HTML.pm, XML.pm: Use ->url attribute to
	obtain the URL of the document.

	* CacheManifest.pm (generate_structure_dump_section): It is
	now i18n'ed.  In addition, since URLs are tend to be long,
	tables for fallback entries are replaced by |dd| entries and
	paragraphs.  "No entry" message is now handled by catalog,
	rather than CSS.

2008-08-16  Wakaba  <wakaba@suika.fam.cx>

++ html/WebHACC/ChangeLog	16 Aug 2008 07:39:54 -0000
	* Input.pm (Subdocument new): Invoke superclass's new method
	such that |urls| attribute is initialized.

	* Result.pm (add_error): Use ->url attribute to obtain
	the URL of the document.  No longer output |text| argument,
	since all error types except for those used in the WebIDL module
	are now defined in the catalog.

2008-08-16  Wakaba  <wakaba@suika.fam.cx>

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     my $manifest = $self->{structure};
42    
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