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

Diff of /test/html-webhacc/WebHACC/Result.pm

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

revision 1.9 by wakaba, Thu Aug 14 15:50:42 2008 UTC revision 1.20 by wakaba, Sun Sep 14 06:33:27 2008 UTC
# Line 52  sub add_error ($%) { Line 52  sub add_error ($%) {
52    my ($self, %opt) = @_;    my ($self, %opt) = @_;
53    
54    my $out = $self->output;    my $out = $self->output;
55      $out->has_error (1);
56    
57    my $error_level = $opt{level};    my $error_level = $opt{level};
58    if (not defined $error_level) {    if (not defined $error_level) {
# Line 80  sub add_error ($%) { Line 81  sub add_error ($%) {
81      $error_layer = 'syntax'; ## NOTE: Unknown - an error of the implementation      $error_layer = 'syntax'; ## NOTE: Unknown - an error of the implementation
82    }    }
83    
   my $error_type_text = $opt{type};  
   
84    my $class = qq[level-$error_level layer-$error_layer];    my $class = qq[level-$error_level layer-$error_layer];
85    
86    ## Line & column numbers (prepare values)    ## Line & column numbers (prepare values)
# Line 118  sub add_error ($%) { Line 117  sub add_error ($%) {
117        $column = $opt{column};        $column = $opt{column};
118      }      }
119    }    }
120      $line += $opt{line_diff} || 0 if defined $line;
121      $column += $opt{column_diff} || 0 if defined $column;
122    $line = $line - 1 || 1    $line = $line - 1 || 1
123        if defined $line and not (defined $column and $column > 0);        if defined $line and not (defined $column and $column > 0);
124    
# Line 171  sub add_error ($%) { Line 172  sub add_error ($%) {
172    
173    if (defined $opt{value}) {    if (defined $opt{value}) {
174      $out->html (' ');      $out->html (' ');
175      $out->code ($opt{value});      if (defined $opt{pos_start}) {
176          $out->start_tag ('code');
177          $out->text (substr $opt{value}, 0, $opt{pos_start});
178          $out->start_tag ('mark');
179          $out->text (substr $opt{value}, $opt{pos_start},
180                          $opt{pos_end} - $opt{pos_start} + 1);
181          $out->end_tag ('mark');
182          $out->text (substr $opt{value}, $opt{pos_end} + 1)
183              if $opt{pos_end} < length $opt{value};
184          $out->end_tag ('code');
185        } elsif ($opt{value_mark_end}) {
186          $out->start_tag ('code');
187          $out->text ($opt{value});
188          $out->start_tag ('mark');
189          $out->end_tag ('mark');
190          $out->end_tag ('code');
191        } elsif (defined $opt{value_mark}) {
192          $out->start_tag ('code');
193          for (split /($opt{value_mark})/, $opt{value}) {
194            if (/$opt{value_mark}/) {
195              $out->start_tag ('mark');
196              $out->text ($_);
197              $out->end_tag ('mark');
198            } else {
199              $out->text ($_);
200            }
201          }
202          $out->end_tag ('code');
203        } else {
204          $out->code ($opt{value});
205        }
206      $has_location = 1;      $has_location = 1;
207    }    }
208    
# Line 186  sub add_error ($%) { Line 217  sub add_error ($%) {
217        } elsif (defined $opt{input}->{request_uri}) {        } elsif (defined $opt{input}->{request_uri}) {
218          $out->url ($opt{input}->{request_uri});          $out->url ($opt{input}->{request_uri});
219          $has_location = 1;          $has_location = 1;
220        } elsif (defined $opt{input}->{uri}) {        } elsif (defined $opt{input}->url) {
221          $out->url ($opt{input}->{uri});          $out->url ($opt{input}->url);
222          $has_location = 1;          $has_location = 1;
223        }        }
224      }      }
225            
226      unless ($has_location) {      unless ($has_location) {
227        $out->text ('Unknown location');        $out->nl_text ('Unknown location');
228      }      }
229    }    }
230    
# Line 204  sub add_error ($%) { Line 235  sub add_error ($%) {
235    $out->text (': ');    $out->text (': ');
236        
237    ## Error message    ## Error message
238    $out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text});    my $error_type_text = $opt{type};
239      $out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text},
240    ## Additional error description                   value => $opt{value}, char => $opt{char},
241    if (defined $opt{text}) {                   octets => $opt{octets});
     $out->html (' (<q>');  
     $out->text ($opt{text});  
     $out->html ('</q>)');  
   }  
242        
243    ## Link to a long description    ## Link to a long description
244    
# Line 219  sub add_error ($%) { Line 246  sub add_error ($%) {
246    $fragment =~ tr/ /-/;    $fragment =~ tr/ /-/;
247    $fragment = $out->encode_url_component ($fragment);    $fragment = $out->encode_url_component ($fragment);
248    $out->text (' [');    $out->text (' [');
249    $out->link ('Description', url => '../error-description#' . $fragment,    $out->start_tag ('a', href => '../error-description#' . $fragment,
250                rel => 'help');                     rel => 'help');
251      $out->nl_text ('Description');
252      $out->end_tag ('a');
253    $out->text (']');    $out->text (']');
254    
255    if ($error_level eq 'm') {    if ($error_level eq 'm') {
# Line 287  sub generate_result_section ($) { Line 316  sub generate_result_section ($) {
316        $out->start_tag ('th', colspan => 7, scope => 'col');        $out->start_tag ('th', colspan => 7, scope => 'col');
317        $out->nl_text ('Main document');        $out->nl_text ('Main document');
318      },      },
319        {label => 'Transfer', status => $self->{layers}->{transfer},        {label => 'Transfer L.', status => $self->{layers}->{transfer},
320         target => 'transfer-errors', score_base => 20,         target => 'transfer-errors', score_base => 20,
321         parent_status => $maindoc_status},         parent_status => $maindoc_status},
322        {label => 'Encode', status => $self->{layers}->{encode},        {label => 'Encode L.', status => $self->{layers}->{encode},
323         score_base => 10,         target => 'parse-errors', score_base => 10,
324         parent_status => $maindoc_status},         parent_status => $maindoc_status},
325        {label => 'Charset', status => $self->{layers}->{charset},        {label => 'Char L.', status => $self->{layers}->{charset},
326         score_base => 10,         target => 'parse-errors', score_base => 10,
327         parent_status => $maindoc_status},         parent_status => $maindoc_status},
328        {label => 'Syntax', status => $self->{layers}->{syntax},        ## TODO: char semantics layer
329          {label => 'Syntax L.', status => $self->{layers}->{syntax},
330         target => 'parse-errors', score_base => 20,         target => 'parse-errors', score_base => 20,
331         parent_status => $maindoc_status},         parent_status => $maindoc_status},
332        {label => 'Structure', status => $self->{layers}->{structure},        {label => 'Structure L.', status => $self->{layers}->{structure},
333         target => 'document-errors', score_base => 20,         target => 'document-errors', score_base => 20,
334         parent_status => $maindoc_status},         parent_status => $maindoc_status},
335        {label => 'Semantics', status => $self->{layers}->{semantics},        {label => 'Semantics L.', status => $self->{layers}->{semantics},
336         score_base => 20,         score_base => 20,
337         parent_status => $maindoc_status},         parent_status => $maindoc_status},
338    );    );

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.20

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24