53 |
|
|
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); |
## Line & column numbers (prepare values) |
|
my $has_location; |
|
|
|
|
|
## URL |
|
|
|
|
|
if (defined $opt{url}) { |
|
|
$out->url ($opt{url}); |
|
|
$has_location = 1; |
|
|
} |
|
|
|
|
|
## Line & column number |
|
57 |
|
|
58 |
my $line; |
my $line; |
59 |
my $column; |
my $column; |
62 |
$line = $opt{node}->get_user_data ('manakai_source_line'); |
$line = $opt{node}->get_user_data ('manakai_source_line'); |
63 |
if (defined $line) { |
if (defined $line) { |
64 |
$column = $opt{node}->get_user_data ('manakai_source_column'); |
$column = $opt{node}->get_user_data ('manakai_source_column'); |
65 |
} else { |
} elsif ($opt{node}->isa ('Message::IF::Node')) { |
66 |
if ($opt{node}->node_type == $opt{node}->ATTRIBUTE_NODE) { |
if ($opt{node}->node_type == $opt{node}->ATTRIBUTE_NODE) { |
67 |
my $owner = $opt{node}->owner_element; |
my $owner = $opt{node}->owner_element; |
68 |
if ($owner) { |
if ($owner) { |
87 |
$column = $opt{column}; |
$column = $opt{column}; |
88 |
} |
} |
89 |
} |
} |
90 |
|
$line = $line - 1 || 1 |
91 |
|
if defined $line and not (defined $column and $column > 0); |
92 |
|
|
93 |
|
$out->start_tag ('dt', class => $class, |
94 |
|
'data-type' => $opt{type}, |
95 |
|
'data-level' => $error_level, |
96 |
|
'data-layer' => $error_layer, |
97 |
|
($line ? ('data-line' => $line) : ()), |
98 |
|
($column ? ('data-column' => $column) : ())); |
99 |
|
my $has_location; |
100 |
|
|
101 |
|
## URL |
102 |
|
|
103 |
|
if (defined $opt{url}) { |
104 |
|
$out->url ($opt{url}); |
105 |
|
$has_location = 1; |
106 |
|
} |
107 |
|
|
108 |
|
## Line & column numbers (real output) |
109 |
|
|
110 |
if (defined $line) { |
if (defined $line) { |
111 |
if (defined $column and $column > 0) { |
if (defined $column and $column > 0) { |
112 |
$out->xref ('Line ' . $line, target => 'line-' . $line); |
$out->xref ('Line #', text => $line, target => 'line-' . $line); |
113 |
$out->text (' column ' . $column); |
$out->text (' '); |
114 |
|
$out->nl_text ('column #', text => $column); |
115 |
} else { |
} else { |
116 |
$line = $line - 1 || 1; |
$out->xref ('Line #', text => $line, target => 'line-' . $line); |
|
$out->xref ('Line ' . $line, target => 'line-' . $line); |
|
117 |
} |
} |
118 |
$has_location = 1; |
$has_location = 1; |
119 |
} |
} |
129 |
if (defined $opt{index}) { |
if (defined $opt{index}) { |
130 |
if ($opt{index_has_link}) { |
if ($opt{index_has_link}) { |
131 |
$out->html (' '); |
$out->html (' '); |
132 |
$out->xref ('Index ' . (0+$opt{index}), |
$out->xref ('Index #', text => (0+$opt{index}), |
133 |
target => 'index-' . (0+$opt{index})); |
target => 'index-' . (0+$opt{index})); |
134 |
} else { |
} else { |
135 |
$out->text (' Index ' . (0+$opt{index})); |
$out->html (' '); |
136 |
|
$out->nl_text ('Index #', text => (0+$opt{index})); |
137 |
} |
} |
138 |
$has_location = 1; |
$has_location = 1; |
139 |
} |
} |
162 |
} |
} |
163 |
|
|
164 |
unless ($has_location) { |
unless ($has_location) { |
165 |
$out->text ('No location information available'); |
$out->text ('Unknown location'); |
166 |
} |
} |
167 |
} |
} |
168 |
|
|
169 |
$out->start_tag ('dd', class => $class); |
$out->start_tag ('dd', class => $class); |
170 |
$out->text ($error_type_text); |
|
171 |
|
## Error level |
172 |
|
|
173 |
|
if ($error_level eq 'm') { |
174 |
|
$out->html (qq[<strong><a href="../error-description#level-m"><em class=rfc2119>MUST</em>-level |
175 |
|
error</a></strong>: ]); |
176 |
|
} elsif ($error_level eq 's') { |
177 |
|
$out->html (qq[<strong><a href="../error-description#level-s"><em class=rfc2119>SHOULD</em>-level |
178 |
|
error</a></strong>: ]); |
179 |
|
} elsif ($error_level eq 'w') { |
180 |
|
$out->html (qq[<strong><a href="../error-description#level-w">Warning</a></strong>: ]); |
181 |
|
} elsif ($error_level eq 'u') { |
182 |
|
$out->html (qq[<strong><a href="../error-description#level-u">Not |
183 |
|
supported</a></strong>: ]); |
184 |
|
} elsif ($error_level eq 'i') { |
185 |
|
$out->html (qq[<strong><a href="../error-description#level-i">Information</a></strong>: ]); |
186 |
|
} |
187 |
|
|
188 |
|
## Error message |
189 |
|
|
190 |
|
$out->nl_text ($error_type_text, node => $opt{node}, text => $opt{text}); |
191 |
|
|
192 |
|
## Additional error description |
193 |
|
|
194 |
if (defined $opt{text}) { |
if (defined $opt{text}) { |
195 |
$out->html (' (<q>'); |
$out->html (' (<q>'); |
196 |
$out->text ($opt{text}); |
$out->text ($opt{text}); |
197 |
$out->html ('</q>)'); |
$out->html ('</q>)'); |
198 |
} |
} |
199 |
|
|
200 |
|
## Link to a long description |
201 |
|
|
202 |
my $fragment = $opt{type}; |
my $fragment = $opt{type}; |
203 |
$fragment =~ tr/ /-/; |
$fragment =~ tr/ /-/; |
204 |
$fragment = $out->encode_url_component ($fragment); |
$fragment = $out->encode_url_component ($fragment); |
205 |
$out->text (' ['); |
$out->text (' ['); |
206 |
$out->link ('Description', url => '../error-description#' . $fragment); |
$out->link ('Description', url => '../error-description#' . $fragment, |
207 |
|
rel => 'help'); |
208 |
$out->text (']'); |
$out->text (']'); |
209 |
|
|
210 |
|
|
328 |
$out->end_section; |
$out->end_section; |
329 |
} # generate_result_section |
} # generate_result_section |
330 |
|
|
|
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 |
|
|
|
|
331 |
1; |
1; |