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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by wakaba, Sun Jul 20 14:58:24 2008 UTC revision 1.6 by wakaba, Fri Aug 15 05:53:23 2008 UTC
# Line 1  Line 1 
1  package WebHACC::Language::CacheManifest;  package WebHACC::Language::CacheManifest;
2  use strict;  use strict;
3  require WebHACC::Language::Base;  require WebHACC::Language::Base;
4  push our @ISA, 'WebHACC::Langauge::Base';  push our @ISA, 'WebHACC::Language::Base';
5    
6  sub new ($) {  sub new ($) {
7    my $self = bless {}, shift;    my $self = bless {}, shift;
# Line 15  sub generate_syntax_error_section ($) { Line 15  sub generate_syntax_error_section ($) {
15    
16    my $out = $self->output;    my $out = $self->output;
17    
18    $out->start_section (id => 'parse-errors', title => 'Parse Errors');    $self->result->layer_uncertain ('charset');
19    $out->start_tag ('dl', id => 'parse-errors-list');  
20      $out->start_section (role => 'parse-errors');
21      $out->start_error_list (role => 'parse-errors');
22      $self->result->layer_applicable ('syntax');
23    
24    my $input = $self->input;    my $input = $self->input;
25    my $result = $self->result;    my $result = $self->result;
26    
27    my $onerror = sub {    $self->result->layer_uncertain ('encode') unless $input->{is_char_string};
     my (%opt) = @_;  
     my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level});  
     $out->html (qq[<dt class="$cls">], get_error_label ($input, \%opt));  
     $type =~ tr/ /-/;  
     $type =~ s/\|/%7C/g;  
     $msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]];  
     $out->html (qq[<dd class="$cls">], get_error_level_label (\%opt) . $msg);  
   
     add_error ('syntax', \%opt => $result);  
   };  
28    
29    my $m = $input->{is_char_string} ? 'parse_char_string' : 'parse_byte_string';    my $m = $input->{is_char_string} ? 'parse_char_string' : 'parse_byte_string';
30    $self->{structure} = Whatpm::CacheManifest->$m    $self->{structure} = Whatpm::CacheManifest->$m
31        ($input->{s}, $input->{uri}, $input->{base_uri}, $onerror);        ($input->{s}, $input->{uri}, $input->{base_uri}, sub {
32            $result->add_error (@_, layer => 'syntax', index_has_link => 1);
33    $out->end_tag ('dl');        });
34          
35      $out->end_error_list (role => 'parse-errors');
36    $out->end_section;    $out->end_section;
37  } # generate_syntax_error_section  } # generate_syntax_error_section
38    
# Line 45  sub generate_structure_dump_section ($) Line 40  sub generate_structure_dump_section ($)
40    my $self = shift;    my $self = shift;
41    my $manifest = $self->{structure};    my $manifest = $self->{structure};
42    
43    $self->start_section (id => 'dump-manifest', title => 'Cache Manifest');    my $out = $self->output;
44    
45      $out->start_section (role => 'structure');
46    
47    $self->html (qq[<dl><dt>Explicit entries</dt>]);    $out->html (qq[<dl><dt>Explicit entries</dt>]);
48    my $i = 0;    my $i = 0;
49    for my $uri (@{$manifest->[0]}) {    for my $uri (@{$manifest->[0]}) {
50      $out->start_tag ('dd', id => 'index-' . $i++);      $out->start_tag ('dd', id => 'index-' . $i++);
# Line 81  sub generate_structure_error_section ($) Line 78  sub generate_structure_error_section ($)
78    
79    my $out = $self->output;    my $out = $self->output;
80    
81    $out->start_section (id => 'document-errors', title => 'Document Errors');    $out->start_section (role => 'structure-errors');
82    $out->start_tag ('dl');    $out->start_error_list (role => 'structure-errors');
83      $self->result->layer_applicable ('structure');
84    
85    my $result = $out->result;    my $result = $self->result;
86    
87    Whatpm::CacheManifest->check_manifest ($self->{structure}, sub {    Whatpm::CacheManifest->check_manifest ($self->{structure}, sub {
88      my %opt = @_;      $result->add_error (@_, layer => 'structure');
     my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level}, $opt{node});  
     $type =~ tr/ /-/;  
     $type =~ s/\|/%7C/g;  
     $msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]];  
     $out->html (qq[<dt class="$cls">] . get_error_label ($input, \%opt) .  
         qq[</dt>\n<dd class="$cls">], $msg, "</dd>\n");  
     add_error ('structure', \%opt => $result);  
89    });    });
90    
91      $out->end_error_list;
92    $out->end_section;    $out->end_section;
93  } # generate_structure_error_section  } # generate_structure_error_section
94    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24