| 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) { |
| 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) |
| 170 |
|
|
| 171 |
if (defined $opt{value}) { |
if (defined $opt{value}) { |
| 172 |
$out->html (' '); |
$out->html (' '); |
| 173 |
$out->code ($opt{value}); |
if (defined $opt{pos_start}) { |
| 174 |
|
$out->start_tag ('code'); |
| 175 |
|
$out->text (substr $opt{value}, 0, $opt{pos_start}); |
| 176 |
|
$out->start_tag ('mark'); |
| 177 |
|
$out->text (substr $opt{value}, $opt{pos_start}, |
| 178 |
|
$opt{pos_end} - $opt{pos_start} + 1); |
| 179 |
|
$out->end_tag ('mark'); |
| 180 |
|
$out->text (substr $opt{value}, $opt{pos_end} + 1); |
| 181 |
|
$out->end_tag ('code'); |
| 182 |
|
} elsif ($opt{value_mark_end}) { |
| 183 |
|
$out->start_tag ('code'); |
| 184 |
|
$out->text ($opt{value}); |
| 185 |
|
$out->start_tag ('mark'); |
| 186 |
|
$out->end_tag ('mark'); |
| 187 |
|
$out->end_tag ('code'); |
| 188 |
|
} elsif (defined $opt{value_mark}) { |
| 189 |
|
$out->start_tag ('code'); |
| 190 |
|
for (split /($opt{value_mark})/, $opt{value}) { |
| 191 |
|
if (/$opt{value_mark}/) { |
| 192 |
|
$out->start_tag ('mark'); |
| 193 |
|
$out->text ($_); |
| 194 |
|
$out->end_tag ('mark'); |
| 195 |
|
} else { |
| 196 |
|
$out->text ($_); |
| 197 |
|
} |
| 198 |
|
} |
| 199 |
|
$out->end_tag ('code'); |
| 200 |
|
} else { |
| 201 |
|
$out->code ($opt{value}); |
| 202 |
|
} |
| 203 |
$has_location = 1; |
$has_location = 1; |
| 204 |
} |
} |
| 205 |
|
|
| 214 |
} elsif (defined $opt{input}->{request_uri}) { |
} elsif (defined $opt{input}->{request_uri}) { |
| 215 |
$out->url ($opt{input}->{request_uri}); |
$out->url ($opt{input}->{request_uri}); |
| 216 |
$has_location = 1; |
$has_location = 1; |
| 217 |
} elsif (defined $opt{input}->{uri}) { |
} elsif (defined $opt{input}->url) { |
| 218 |
$out->url ($opt{input}->{uri}); |
$out->url ($opt{input}->url); |
| 219 |
$has_location = 1; |
$has_location = 1; |
| 220 |
} |
} |
| 221 |
} |
} |
| 222 |
|
|
| 223 |
unless ($has_location) { |
unless ($has_location) { |
| 224 |
$out->text ('Unknown location'); |
$out->nl_text ('Unknown location'); |
| 225 |
} |
} |
| 226 |
} |
} |
| 227 |
|
|
| 232 |
$out->text (': '); |
$out->text (': '); |
| 233 |
|
|
| 234 |
## Error message |
## Error message |
| 235 |
$out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text}); |
my $error_type_text = $opt{type}; |
| 236 |
|
$out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text}, |
| 237 |
## Additional error description |
value => $opt{value}); |
|
if (defined $opt{text}) { |
|
|
$out->html (' (<q>'); |
|
|
$out->text ($opt{text}); |
|
|
$out->html ('</q>)'); |
|
|
} |
|
| 238 |
|
|
| 239 |
## Link to a long description |
## Link to a long description |
| 240 |
|
|
| 242 |
$fragment =~ tr/ /-/; |
$fragment =~ tr/ /-/; |
| 243 |
$fragment = $out->encode_url_component ($fragment); |
$fragment = $out->encode_url_component ($fragment); |
| 244 |
$out->text (' ['); |
$out->text (' ['); |
| 245 |
$out->link ('Description', url => '../error-description#' . $fragment, |
$out->start_tag ('a', href => '../error-description#' . $fragment, |
| 246 |
rel => 'help'); |
rel => 'help'); |
| 247 |
|
$out->nl_text ('Description'); |
| 248 |
|
$out->end_tag ('a'); |
| 249 |
$out->text (']'); |
$out->text (']'); |
| 250 |
|
|
| 251 |
if ($error_level eq 'm') { |
if ($error_level eq 'm') { |
| 312 |
$out->start_tag ('th', colspan => 7, scope => 'col'); |
$out->start_tag ('th', colspan => 7, scope => 'col'); |
| 313 |
$out->nl_text ('Main document'); |
$out->nl_text ('Main document'); |
| 314 |
}, |
}, |
| 315 |
{label => 'Transfer', status => $self->{layers}->{transfer}, |
{label => 'Transfer L.', status => $self->{layers}->{transfer}, |
| 316 |
target => 'transfer-errors', score_base => 20, |
target => 'transfer-errors', score_base => 20, |
| 317 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 318 |
{label => 'Encode', status => $self->{layers}->{encode}, |
{label => 'Encode L.', status => $self->{layers}->{encode}, |
| 319 |
score_base => 10, |
target => 'parse-errors', score_base => 10, |
| 320 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 321 |
{label => 'Charset', status => $self->{layers}->{charset}, |
{label => 'Char L.', status => $self->{layers}->{charset}, |
| 322 |
score_base => 10, |
score_base => 10, |
| 323 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 324 |
{label => 'Syntax', status => $self->{layers}->{syntax}, |
{label => 'Syntax L.', status => $self->{layers}->{syntax}, |
| 325 |
target => 'parse-errors', score_base => 20, |
target => 'parse-errors', score_base => 20, |
| 326 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 327 |
{label => 'Structure', status => $self->{layers}->{structure}, |
{label => 'Structure L.', status => $self->{layers}->{structure}, |
| 328 |
target => 'document-errors', score_base => 20, |
target => 'document-errors', score_base => 20, |
| 329 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 330 |
{label => 'Semantics', status => $self->{layers}->{semantics}, |
{label => 'Semantics L.', status => $self->{layers}->{semantics}, |
| 331 |
score_base => 20, |
score_base => 20, |
| 332 |
parent_status => $maindoc_status}, |
parent_status => $maindoc_status}, |
| 333 |
); |
); |