54 |
my $class = qq[level-$error_level layer-$error_layer]; |
my $class = qq[level-$error_level layer-$error_layer]; |
55 |
|
|
56 |
$out->start_tag ('dt', class => $class); |
$out->start_tag ('dt', class => $class); |
57 |
|
my $has_location; |
58 |
|
|
59 |
## URL |
## URL |
60 |
|
|
61 |
if (defined $opt{url}) { |
if (defined $opt{url}) { |
62 |
$out->url ($opt{url}); |
$out->url ($opt{url}); |
63 |
|
$has_location = 1; |
64 |
} |
} |
65 |
|
|
66 |
## Line & column number |
## Line & column number |
106 |
$line = $line - 1 || 1; |
$line = $line - 1 || 1; |
107 |
$out->xref ('Line ' . $line, target => 'line-' . $line); |
$out->xref ('Line ' . $line, target => 'line-' . $line); |
108 |
} |
} |
109 |
|
$has_location = 1; |
110 |
} |
} |
111 |
|
|
112 |
## Node path |
## Node path |
114 |
if (defined $opt{node}) { |
if (defined $opt{node}) { |
115 |
$out->html (' '); |
$out->html (' '); |
116 |
$out->node_link ($opt{node}); |
$out->node_link ($opt{node}); |
117 |
|
$has_location = 1; |
118 |
} |
} |
119 |
|
|
120 |
if (defined $opt{index}) { |
if (defined $opt{index}) { |
125 |
} else { |
} else { |
126 |
$out->text (' Index ' . (0+$opt{index})); |
$out->text (' Index ' . (0+$opt{index})); |
127 |
} |
} |
128 |
|
$has_location = 1; |
129 |
} |
} |
130 |
|
|
131 |
if (defined $opt{value}) { |
if (defined $opt{value}) { |
132 |
$out->html (' '); |
$out->html (' '); |
133 |
$out->code ($opt{value}); |
$out->code ($opt{value}); |
134 |
|
$has_location = 1; |
135 |
|
} |
136 |
|
|
137 |
|
unless ($has_location) { |
138 |
|
if (defined $opt{input}) { |
139 |
|
if (defined $opt{input}->{container_node}) { |
140 |
|
my $original_input = $out->input; |
141 |
|
$out->input ($opt{input}->{parent_input}); |
142 |
|
$out->node_link ($opt{input}->{container_node}); |
143 |
|
$out->input ($original_input); |
144 |
|
$has_location = 1; |
145 |
|
} elsif (defined $opt{input}->{request_uri}) { |
146 |
|
$out->url ($opt{input}->{request_uri}); |
147 |
|
$has_location = 1; |
148 |
|
} elsif (defined $opt{input}->{uri}) { |
149 |
|
$out->url ($opt{input}->{uri}); |
150 |
|
$has_location = 1; |
151 |
|
} |
152 |
|
} |
153 |
|
|
154 |
|
unless ($has_location) { |
155 |
|
$out->text ('Unknown location'); |
156 |
|
} |
157 |
} |
} |
158 |
|
|
159 |
$out->start_tag ('dd', class => $class); |
$out->start_tag ('dd', class => $class); |
160 |
|
|
161 |
|
## Error level |
162 |
|
|
163 |
|
if ($error_level eq 'm') { |
164 |
|
$out->html (qq[<strong><a href="../error-description#level-m"><em class=rfc2119>MUST</em>-level |
165 |
|
error</a></strong>: ]); |
166 |
|
} elsif ($error_level eq 's') { |
167 |
|
$out->html (qq[<strong><a href="../error-description#level-s"><em class=rfc2119>SHOULD</em>-level |
168 |
|
error</a></strong>: ]); |
169 |
|
} elsif ($error_level eq 'w') { |
170 |
|
$out->html (qq[<strong><a href="../error-description#level-w">Warning</a></strong>: ]); |
171 |
|
} elsif ($error_level eq 'u') { |
172 |
|
$out->html (qq[<strong><a href="../error-description#level-u">Not |
173 |
|
supported</a></strong>: ]); |
174 |
|
} elsif ($error_level eq 'i') { |
175 |
|
$out->html (qq[<strong><a href="../error-description#level-i">Information</a></strong>: ]); |
176 |
|
} |
177 |
|
|
178 |
|
## Error message |
179 |
|
|
180 |
$out->text ($error_type_text); |
$out->text ($error_type_text); |
181 |
|
|
182 |
|
## Additional error description |
183 |
|
|
184 |
if (defined $opt{text}) { |
if (defined $opt{text}) { |
185 |
$out->html (' (<q>'); |
$out->html (' (<q>'); |
186 |
$out->text ($opt{text}); |
$out->text ($opt{text}); |
187 |
$out->html ('</q>)'); |
$out->html ('</q>)'); |
188 |
} |
} |
189 |
|
|
190 |
|
## Link to a long description |
191 |
|
|
192 |
my $fragment = $opt{type}; |
my $fragment = $opt{type}; |
193 |
$fragment =~ tr/ /-/; |
$fragment =~ tr/ /-/; |
194 |
$fragment = $out->encode_url_component ($fragment); |
$fragment = $out->encode_url_component ($fragment); |
195 |
$out->text (' ['); |
$out->text (' ['); |
196 |
$out->link ('Description', url => '../error-description#' . $fragment); |
$out->link ('Description', url => '../error-description#' . $fragment, |
197 |
|
rel => 'help'); |
198 |
$out->text (']'); |
$out->text (']'); |
199 |
|
|
200 |
|
|
318 |
$out->end_section; |
$out->end_section; |
319 |
} # generate_result_section |
} # generate_result_section |
320 |
|
|
|
sub _get_error_label ($$) { |
|
|
my $self = shift; |
|
|
my ($input, $err) = @_; |
|
|
|
|
|
|
|
|
} # get_error_label |
|
|
|
|
|
sub get_error_level_label ($) { |
|
|
my $self = shift; |
|
|
my $err = shift; |
|
|
|
|
|
my $r = ''; |
|
|
|
|
|
if (not defined $err->{level} or $err->{level} eq 'm') { |
|
|
$r = qq[<strong><a href="../error-description#level-m"><em class=rfc2119>MUST</em>-level |
|
|
error</a></strong>: ]; |
|
|
} elsif ($err->{level} eq 's') { |
|
|
$r = qq[<strong><a href="../error-description#level-s"><em class=rfc2119>SHOULD</em>-level |
|
|
error</a></strong>: ]; |
|
|
} elsif ($err->{level} eq 'w') { |
|
|
$r = qq[<strong><a href="../error-description#level-w">Warning</a></strong>: |
|
|
]; |
|
|
} elsif ($err->{level} eq 'u' or $err->{level} eq 'unsupported') { |
|
|
$r = qq[<strong><a href="../error-description#level-u">Not |
|
|
supported</a></strong>: ]; |
|
|
} elsif ($err->{level} eq 'i') { |
|
|
$r = qq[<strong><a href="../error-description#level-i">Information</a></strong>: ]; |
|
|
} else { |
|
|
my $elevel = htescape ($err->{level}); |
|
|
$r = qq[<strong><a href="../error-description#level-$elevel">$elevel</a></strong>: |
|
|
]; |
|
|
} |
|
|
|
|
|
return $r; |
|
|
} # get_error_level_label |
|
|
|
|
|
sub get_node_path ($) { |
|
|
my $self = shift; |
|
|
my $node = shift; |
|
|
my @r; |
|
|
while (defined $node) { |
|
|
my $rs; |
|
|
if ($node->node_type == 1) { |
|
|
$rs = $node->node_name; |
|
|
$node = $node->parent_node; |
|
|
} elsif ($node->node_type == 2) { |
|
|
$rs = '@' . $node->node_name; |
|
|
$node = $node->owner_element; |
|
|
} elsif ($node->node_type == 3) { |
|
|
$rs = '"' . $node->data . '"'; |
|
|
$node = $node->parent_node; |
|
|
} elsif ($node->node_type == 9) { |
|
|
@r = ('') unless @r; |
|
|
$rs = ''; |
|
|
$node = $node->parent_node; |
|
|
} else { |
|
|
$rs = '#' . $node->node_type; |
|
|
$node = $node->parent_node; |
|
|
} |
|
|
unshift @r, $rs; |
|
|
} |
|
|
return join '/', @r; |
|
|
} # get_node_path |
|
|
|
|
|
use Scalar::Util qw/refaddr/; |
|
|
|
|
|
sub get_node_link ($$) { |
|
|
my $self = shift; |
|
|
return qq[<a href="#$_[0]->{id_prefix}node-@{[refaddr $_[1]]}">] . |
|
|
($self->get_node_path ($_[1])) . qq[</a>]; |
|
|
## BUG: ^ must be escaped |
|
|
} # get_node_link |
|
|
|
|
321 |
1; |
1; |