54 |
my $inner_html_element = $http->get_parameter ('e'); |
my $inner_html_element = $http->get_parameter ('e'); |
55 |
my $char_length = 0; |
my $char_length = 0; |
56 |
my %time; |
my %time; |
|
my $time1; |
|
|
my $time2; |
|
57 |
|
|
58 |
print qq[ |
print qq[ |
59 |
<div id="document-info" class="section"> |
<div id="document-info" class="section"> |
89 |
my $el; |
my $el; |
90 |
|
|
91 |
if ($input->{media_type} eq 'text/html') { |
if ($input->{media_type} eq 'text/html') { |
92 |
require Encode; |
($doc, $el) = print_syntax_error_html_section ($input); |
|
require Whatpm::HTML; |
|
|
|
|
|
$input->{charset} ||= 'ISO-8859-1'; ## TODO: for now. |
|
|
|
|
|
$time1 = time; |
|
|
my $t = Encode::decode ($input->{charset}, $input->{s}); |
|
|
$time2 = time; |
|
|
$time{decode} = $time2 - $time1; |
|
|
|
|
|
print STDOUT qq[ |
|
|
<div id="parse-errors" class="section"> |
|
|
<h2>Parse Errors</h2> |
|
|
|
|
|
<dl>]; |
|
|
push @nav, ['#parse-errors' => 'Parse Error']; |
|
|
|
|
|
my $onerror = sub { |
|
|
my (%opt) = @_; |
|
|
my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level}); |
|
|
if ($opt{column} > 0) { |
|
|
print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a> column $opt{column}</dt>\n]; |
|
|
} else { |
|
|
$opt{line} = $opt{line} - 1 || 1; |
|
|
print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a></dt>\n]; |
|
|
} |
|
|
$type =~ tr/ /-/; |
|
|
$type =~ s/\|/%7C/g; |
|
|
$msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]]; |
|
|
print STDOUT qq[<dd class="$cls">$msg</dd>\n]; |
|
|
}; |
|
|
|
|
|
$doc = $dom->create_document; |
|
|
$time1 = time; |
|
|
if (defined $inner_html_element and length $inner_html_element) { |
|
|
$el = $doc->create_element_ns |
|
|
('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]); |
|
|
Whatpm::HTML->set_inner_html ($el, $t, $onerror); |
|
|
} else { |
|
|
Whatpm::HTML->parse_string ($t => $doc, $onerror); |
|
|
} |
|
|
$time2 = time; |
|
|
$time{parse} = $time2 - $time1; |
|
|
|
|
|
print STDOUT qq[</dl> |
|
|
</div> |
|
|
]; |
|
|
|
|
93 |
print_source_string_section (\($input->{s}), $input->{charset}); |
print_source_string_section (\($input->{s}), $input->{charset}); |
94 |
} elsif ({ |
} elsif ({ |
95 |
'text/xml' => 1, |
'text/xml' => 1, |
99 |
'application/xhtml+xml' => 1, |
'application/xhtml+xml' => 1, |
100 |
'application/xml' => 1, |
'application/xml' => 1, |
101 |
}->{$input->{media_type}}) { |
}->{$input->{media_type}}) { |
102 |
require Message::DOM::XMLParserTemp; |
($doc, $el) = print_syntax_error_xml_section ($input); |
|
|
|
|
print STDOUT qq[ |
|
|
<div id="parse-errors" class="section"> |
|
|
<h2>Parse Errors</h2> |
|
|
|
|
|
<dl>]; |
|
|
push @nav, ['#parse-errors' => 'Parse Error']; |
|
|
|
|
|
my $onerror = sub { |
|
|
my $err = shift; |
|
|
my $line = $err->location->line_number; |
|
|
print STDOUT qq[<dt><a href="#line-$line">Line $line</a> column ]; |
|
|
print STDOUT $err->location->column_number, "</dt><dd>"; |
|
|
print STDOUT htescape $err->text, "</dd>\n"; |
|
|
return 1; |
|
|
}; |
|
|
|
|
|
$time1 = time; |
|
|
open my $fh, '<', \($input->{s}); |
|
|
$doc = Message::DOM::XMLParserTemp->parse_byte_stream |
|
|
($fh => $dom, $onerror, charset => $input->{charset}); |
|
|
$time2 = time; |
|
|
$time{parse_xml} = $time2 - $time1; |
|
|
|
|
|
print STDOUT qq[</dl> |
|
|
</div> |
|
|
|
|
|
]; |
|
103 |
print_source_string_section (\($input->{s}), $doc->input_encoding); |
print_source_string_section (\($input->{s}), $doc->input_encoding); |
104 |
} else { |
} else { |
105 |
## TODO: Change HTTP status code?? |
## TODO: Change HTTP status code?? |
106 |
print STDOUT qq[ |
print_result_unknown_type_section ($input); |
|
<div id="result-summary" class="section"> |
|
|
<p><em>Media type <code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code> is not supported!</em></p> |
|
|
</div> |
|
|
]; |
|
|
push @nav, ['#result-summary' => 'Result']; |
|
107 |
} |
} |
108 |
|
|
|
|
|
109 |
if (defined $doc or defined $el) { |
if (defined $doc or defined $el) { |
110 |
print STDOUT qq[ |
print_structure_dump_section ($doc, $el); |
111 |
<div id="document-tree" class="section"> |
my $elements = print_structure_error_section ($doc, $el); |
112 |
<h2>Document Tree</h2> |
print_table_section ($elements->{table}) if @{$elements->{table}}; |
113 |
]; |
print_id_section ($elements->{id}) if keys %{$elements->{id}}; |
114 |
push @nav, ['#document-tree' => 'Tree']; |
print_term_section ($elements->{term}) if keys %{$elements->{term}}; |
115 |
|
print_class_section ($elements->{class}) if keys %{$elements->{class}}; |
|
print_document_tree ($el || $doc); |
|
|
|
|
|
print STDOUT qq[ |
|
|
</div> |
|
|
|
|
|
<div id="document-errors" class="section"> |
|
|
<h2>Document Errors</h2> |
|
|
|
|
|
<dl>]; |
|
|
push @nav, ['#document-errors' => 'Document Error']; |
|
|
|
|
|
require Whatpm::ContentChecker; |
|
|
my $onerror = sub { |
|
|
my %opt = @_; |
|
|
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>]]; |
|
|
print STDOUT qq[<dt class="$cls">] . get_node_link ($opt{node}) . |
|
|
qq[</dt>\n<dd class="$cls">], $msg, "</dd>\n"; |
|
|
}; |
|
|
|
|
|
$time1 = time; |
|
|
my $elements; |
|
|
if ($el) { |
|
|
$elements = Whatpm::ContentChecker->check_element ($el, $onerror); |
|
|
} else { |
|
|
$elements = Whatpm::ContentChecker->check_document ($doc, $onerror); |
|
|
} |
|
|
$time2 = time; |
|
|
$time{check} = $time2 - $time1; |
|
|
|
|
|
print STDOUT qq[</dl> |
|
|
</div> |
|
|
]; |
|
|
|
|
|
if (@{$elements->{table}}) { |
|
|
require JSON; |
|
|
|
|
|
push @nav, ['#tables' => 'Tables']; |
|
|
print STDOUT qq[ |
|
|
<div id="tables" class="section"> |
|
|
<h2>Tables</h2> |
|
|
|
|
|
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]--> |
|
|
<script src="../table-script.js" type="text/javascript"></script> |
|
|
<noscript> |
|
|
<p><em>Structure of tables are visualized here if scripting is enabled.</em></p> |
|
|
</noscript> |
|
|
]; |
|
|
|
|
|
my $i = 0; |
|
|
for my $table_el (@{$elements->{table}}) { |
|
|
$i++; |
|
|
print STDOUT qq[<div class="section" id="table-$i"><h3>] . |
|
|
get_node_link ($table_el) . q[</h3>]; |
|
|
|
|
|
## TODO: Make |ContentChecker| return |form_table| result |
|
|
## so that this script don't have to run the algorithm twice. |
|
|
my $table = Whatpm::HTMLTable->form_table ($table_el); |
|
|
|
|
|
for (@{$table->{column_group}}, @{$table->{column}}, $table->{caption}) { |
|
|
next unless $_; |
|
|
delete $_->{element}; |
|
|
} |
|
|
|
|
|
for (@{$table->{row_group}}) { |
|
|
next unless $_; |
|
|
next unless $_->{element}; |
|
|
$_->{type} = $_->{element}->manakai_local_name; |
|
|
delete $_->{element}; |
|
|
} |
|
|
|
|
|
for (@{$table->{cell}}) { |
|
|
next unless $_; |
|
|
for (@{$_}) { |
|
|
next unless $_; |
|
|
for (@$_) { |
|
|
$_->{id} = refaddr $_->{element} if defined $_->{element}; |
|
|
delete $_->{element}; |
|
|
$_->{is_header} = $_->{is_header} ? 1 : 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
print STDOUT '</div><script type="text/javascript">tableToCanvas ('; |
|
|
print STDOUT JSON::objToJson ($table); |
|
|
print STDOUT qq[, document.getElementById ('table-$i'));</script>]; |
|
|
} |
|
|
|
|
|
print STDOUT qq[</div>]; |
|
|
} |
|
|
|
|
|
if (keys %{$elements->{id}}) { |
|
|
push @nav, ['#identifiers' => 'IDs']; |
|
|
print STDOUT qq[ |
|
|
<div id="identifiers" class="section"> |
|
|
<h2>Identifiers</h2> |
|
|
|
|
|
<dl> |
|
|
]; |
|
|
for my $id (sort {$a cmp $b} keys %{$elements->{id}}) { |
|
|
print STDOUT qq[<dt><code>@{[htescape $id]}</code></dt>]; |
|
|
for (@{$elements->{id}->{$id}}) { |
|
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
|
|
} |
|
|
} |
|
|
print STDOUT qq[</dl></div>]; |
|
|
} |
|
|
|
|
|
if (keys %{$elements->{term}}) { |
|
|
push @nav, ['#terms' => 'Terms']; |
|
|
print STDOUT qq[ |
|
|
<div id="terms" class="section"> |
|
|
<h2>Terms</h2> |
|
|
|
|
|
<dl> |
|
|
]; |
|
|
for my $term (sort {$a cmp $b} keys %{$elements->{term}}) { |
|
|
print STDOUT qq[<dt>@{[htescape $term]}</dt>]; |
|
|
for (@{$elements->{term}->{$term}}) { |
|
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
|
|
} |
|
|
} |
|
|
print STDOUT qq[</dl></div>]; |
|
|
} |
|
|
|
|
|
if (keys %{$elements->{class}}) { |
|
|
push @nav, ['#classes' => 'Classes']; |
|
|
print STDOUT qq[ |
|
|
<div id="classes" class="section"> |
|
|
<h2>Classes</h2> |
|
|
|
|
|
<dl> |
|
|
]; |
|
|
for my $class (sort {$a cmp $b} keys %{$elements->{class}}) { |
|
|
print STDOUT qq[<dt><code>@{[htescape $class]}</code></dt>]; |
|
|
for (@{$elements->{class}->{$class}}) { |
|
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
|
|
} |
|
|
} |
|
|
print STDOUT qq[</dl></div>]; |
|
|
} |
|
116 |
} |
} |
117 |
|
|
118 |
## TODO: Show result |
## TODO: Show result |
119 |
} else { |
} else { |
120 |
print STDOUT qq[ |
print STDOUT qq[</dl></div>]; |
121 |
</dl> |
print_result_input_error_section ($input); |
|
</div> |
|
|
|
|
|
<div class="section" id="result-summary"> |
|
|
<p><em><strong>Input Error</strong>: @{[htescape ($input->{error_status_text})]}</em></p> |
|
|
</div> |
|
|
]; |
|
|
push @nav, ['#result-summary' => 'Result']; |
|
|
|
|
122 |
} |
} |
123 |
|
|
124 |
print STDOUT qq[ |
print STDOUT qq[ |
175 |
print STDOUT qq[</tbody></table></div>]; |
print STDOUT qq[</tbody></table></div>]; |
176 |
} # print_http_header_section |
} # print_http_header_section |
177 |
|
|
178 |
|
sub print_syntax_error_html_section ($) { |
179 |
|
my $input = shift; |
180 |
|
|
181 |
|
require Encode; |
182 |
|
require Whatpm::HTML; |
183 |
|
|
184 |
|
$input->{charset} ||= 'ISO-8859-1'; ## TODO: for now. |
185 |
|
|
186 |
|
my $time1 = time; |
187 |
|
my $t = Encode::decode ($input->{charset}, $input->{s}); |
188 |
|
$time{decode} = time - $time1; |
189 |
|
|
190 |
|
print STDOUT qq[ |
191 |
|
<div id="parse-errors" class="section"> |
192 |
|
<h2>Parse Errors</h2> |
193 |
|
|
194 |
|
<dl>]; |
195 |
|
push @nav, ['#parse-errors' => 'Parse Error']; |
196 |
|
|
197 |
|
my $onerror = sub { |
198 |
|
my (%opt) = @_; |
199 |
|
my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level}); |
200 |
|
if ($opt{column} > 0) { |
201 |
|
print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a> column $opt{column}</dt>\n]; |
202 |
|
} else { |
203 |
|
$opt{line} = $opt{line} - 1 || 1; |
204 |
|
print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a></dt>\n]; |
205 |
|
} |
206 |
|
$type =~ tr/ /-/; |
207 |
|
$type =~ s/\|/%7C/g; |
208 |
|
$msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]]; |
209 |
|
print STDOUT qq[<dd class="$cls">$msg</dd>\n]; |
210 |
|
}; |
211 |
|
|
212 |
|
my $doc = $dom->create_document; |
213 |
|
my $el; |
214 |
|
$time1 = time; |
215 |
|
if (defined $inner_html_element and length $inner_html_element) { |
216 |
|
$el = $doc->create_element_ns |
217 |
|
('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]); |
218 |
|
Whatpm::HTML->set_inner_html ($el, $t, $onerror); |
219 |
|
} else { |
220 |
|
Whatpm::HTML->parse_string ($t => $doc, $onerror); |
221 |
|
} |
222 |
|
$time{parse} = time - $time1; |
223 |
|
|
224 |
|
print STDOUT qq[</dl></div>]; |
225 |
|
|
226 |
|
return ($doc, $el); |
227 |
|
} # print_syntax_error_html_section |
228 |
|
|
229 |
|
sub print_syntax_error_xml_section ($) { |
230 |
|
my $input = shift; |
231 |
|
|
232 |
|
require Message::DOM::XMLParserTemp; |
233 |
|
|
234 |
|
print STDOUT qq[ |
235 |
|
<div id="parse-errors" class="section"> |
236 |
|
<h2>Parse Errors</h2> |
237 |
|
|
238 |
|
<dl>]; |
239 |
|
push @nav, ['#parse-errors' => 'Parse Error']; |
240 |
|
|
241 |
|
my $onerror = sub { |
242 |
|
my $err = shift; |
243 |
|
my $line = $err->location->line_number; |
244 |
|
print STDOUT qq[<dt><a href="#line-$line">Line $line</a> column ]; |
245 |
|
print STDOUT $err->location->column_number, "</dt><dd>"; |
246 |
|
print STDOUT htescape $err->text, "</dd>\n"; |
247 |
|
return 1; |
248 |
|
}; |
249 |
|
|
250 |
|
my $time1 = time; |
251 |
|
open my $fh, '<', \($input->{s}); |
252 |
|
my $doc = Message::DOM::XMLParserTemp->parse_byte_stream |
253 |
|
($fh => $dom, $onerror, charset => $input->{charset}); |
254 |
|
$time{parse_xml} = time - $time1; |
255 |
|
|
256 |
|
print STDOUT qq[</dl></div>]; |
257 |
|
|
258 |
|
return ($doc, undef); |
259 |
|
} # print_syntax_error_xml_section |
260 |
|
|
261 |
sub print_source_string_section ($$) { |
sub print_source_string_section ($$) { |
262 |
require Encode; |
require Encode; |
263 |
my $enc = Encode::find_encoding ($_[1]); ## TODO: charset name -> Perl name |
my $enc = Encode::find_encoding ($_[1]); ## TODO: charset name -> Perl name |
360 |
print STDOUT $r; |
print STDOUT $r; |
361 |
} # print_document_tree |
} # print_document_tree |
362 |
|
|
363 |
|
sub print_structure_dump_section ($$) { |
364 |
|
my ($doc, $el) = @_; |
365 |
|
|
366 |
|
print STDOUT qq[ |
367 |
|
<div id="document-tree" class="section"> |
368 |
|
<h2>Document Tree</h2> |
369 |
|
]; |
370 |
|
push @nav, ['#document-tree' => 'Tree']; |
371 |
|
|
372 |
|
print_document_tree ($el || $doc); |
373 |
|
|
374 |
|
print STDOUT qq[</div>]; |
375 |
|
} # print_structure_dump_section |
376 |
|
|
377 |
|
sub print_structure_error_section ($$) { |
378 |
|
my ($doc, $el) = @_; |
379 |
|
|
380 |
|
print STDOUT qq[<div id="document-errors" class="section"> |
381 |
|
<h2>Document Errors</h2> |
382 |
|
|
383 |
|
<dl>]; |
384 |
|
push @nav, ['#document-errors' => 'Document Error']; |
385 |
|
|
386 |
|
require Whatpm::ContentChecker; |
387 |
|
my $onerror = sub { |
388 |
|
my %opt = @_; |
389 |
|
my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level}, $opt{node}); |
390 |
|
$type =~ tr/ /-/; |
391 |
|
$type =~ s/\|/%7C/g; |
392 |
|
$msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]]; |
393 |
|
print STDOUT qq[<dt class="$cls">] . get_node_link ($opt{node}) . |
394 |
|
qq[</dt>\n<dd class="$cls">], $msg, "</dd>\n"; |
395 |
|
}; |
396 |
|
|
397 |
|
my $elements; |
398 |
|
my $time1 = time; |
399 |
|
if ($el) { |
400 |
|
$elements = Whatpm::ContentChecker->check_element ($el, $onerror); |
401 |
|
} else { |
402 |
|
$elements = Whatpm::ContentChecker->check_document ($doc, $onerror); |
403 |
|
} |
404 |
|
$time{check} = time - $time1; |
405 |
|
|
406 |
|
print STDOUT qq[</dl></div>]; |
407 |
|
|
408 |
|
return $elements; |
409 |
|
} # print_structure_error_section |
410 |
|
|
411 |
|
sub print_table_section ($) { |
412 |
|
my $tables = shift; |
413 |
|
|
414 |
|
push @nav, ['#tables' => 'Tables']; |
415 |
|
print STDOUT qq[ |
416 |
|
<div id="tables" class="section"> |
417 |
|
<h2>Tables</h2> |
418 |
|
|
419 |
|
<!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]--> |
420 |
|
<script src="../table-script.js" type="text/javascript"></script> |
421 |
|
<noscript> |
422 |
|
<p><em>Structure of tables are visualized here if scripting is enabled.</em></p> |
423 |
|
</noscript> |
424 |
|
]; |
425 |
|
|
426 |
|
require JSON; |
427 |
|
|
428 |
|
my $i = 0; |
429 |
|
for my $table_el (@$tables) { |
430 |
|
$i++; |
431 |
|
print STDOUT qq[<div class="section" id="table-$i"><h3>] . |
432 |
|
get_node_link ($table_el) . q[</h3>]; |
433 |
|
|
434 |
|
## TODO: Make |ContentChecker| return |form_table| result |
435 |
|
## so that this script don't have to run the algorithm twice. |
436 |
|
my $table = Whatpm::HTMLTable->form_table ($table_el); |
437 |
|
|
438 |
|
for (@{$table->{column_group}}, @{$table->{column}}, $table->{caption}) { |
439 |
|
next unless $_; |
440 |
|
delete $_->{element}; |
441 |
|
} |
442 |
|
|
443 |
|
for (@{$table->{row_group}}) { |
444 |
|
next unless $_; |
445 |
|
next unless $_->{element}; |
446 |
|
$_->{type} = $_->{element}->manakai_local_name; |
447 |
|
delete $_->{element}; |
448 |
|
} |
449 |
|
|
450 |
|
for (@{$table->{cell}}) { |
451 |
|
next unless $_; |
452 |
|
for (@{$_}) { |
453 |
|
next unless $_; |
454 |
|
for (@$_) { |
455 |
|
$_->{id} = refaddr $_->{element} if defined $_->{element}; |
456 |
|
delete $_->{element}; |
457 |
|
$_->{is_header} = $_->{is_header} ? 1 : 0; |
458 |
|
} |
459 |
|
} |
460 |
|
} |
461 |
|
|
462 |
|
print STDOUT '</div><script type="text/javascript">tableToCanvas ('; |
463 |
|
print STDOUT JSON::objToJson ($table); |
464 |
|
print STDOUT qq[, document.getElementById ('table-$i'));</script>]; |
465 |
|
} |
466 |
|
|
467 |
|
print STDOUT qq[</div>]; |
468 |
|
} # print_table_section |
469 |
|
|
470 |
|
sub print_id_section ($) { |
471 |
|
my $ids = shift; |
472 |
|
|
473 |
|
push @nav, ['#identifiers' => 'IDs']; |
474 |
|
print STDOUT qq[ |
475 |
|
<div id="identifiers" class="section"> |
476 |
|
<h2>Identifiers</h2> |
477 |
|
|
478 |
|
<dl> |
479 |
|
]; |
480 |
|
for my $id (sort {$a cmp $b} keys %$ids) { |
481 |
|
print STDOUT qq[<dt><code>@{[htescape $id]}</code></dt>]; |
482 |
|
for (@{$ids->{$id}}) { |
483 |
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
484 |
|
} |
485 |
|
} |
486 |
|
print STDOUT qq[</dl></div>]; |
487 |
|
} # print_id_section |
488 |
|
|
489 |
|
sub print_term_section ($) { |
490 |
|
my $terms = shift; |
491 |
|
|
492 |
|
push @nav, ['#terms' => 'Terms']; |
493 |
|
print STDOUT qq[ |
494 |
|
<div id="terms" class="section"> |
495 |
|
<h2>Terms</h2> |
496 |
|
|
497 |
|
<dl> |
498 |
|
]; |
499 |
|
for my $term (sort {$a cmp $b} keys %$terms) { |
500 |
|
print STDOUT qq[<dt>@{[htescape $term]}</dt>]; |
501 |
|
for (@{$terms->{$term}}) { |
502 |
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
503 |
|
} |
504 |
|
} |
505 |
|
print STDOUT qq[</dl></div>]; |
506 |
|
} # print_term_section |
507 |
|
|
508 |
|
sub print_class_section ($) { |
509 |
|
my $classes = shift; |
510 |
|
|
511 |
|
push @nav, ['#classes' => 'Classes']; |
512 |
|
print STDOUT qq[ |
513 |
|
<div id="classes" class="section"> |
514 |
|
<h2>Classes</h2> |
515 |
|
|
516 |
|
<dl> |
517 |
|
]; |
518 |
|
for my $class (sort {$a cmp $b} keys %$classes) { |
519 |
|
print STDOUT qq[<dt><code>@{[htescape $class]}</code></dt>]; |
520 |
|
for (@{$classes->{$class}}) { |
521 |
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
522 |
|
} |
523 |
|
} |
524 |
|
print STDOUT qq[</dl></div>]; |
525 |
|
} # print_class_section |
526 |
|
|
527 |
|
sub print_result_unknown_type_section ($) { |
528 |
|
my $input = shift; |
529 |
|
|
530 |
|
print STDOUT qq[ |
531 |
|
<div id="result-summary" class="section"> |
532 |
|
<p><em>Media type <code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code> is not supported!</em></p> |
533 |
|
</div> |
534 |
|
]; |
535 |
|
push @nav, ['#result-summary' => 'Result']; |
536 |
|
} # print_result_unknown_type_section |
537 |
|
|
538 |
|
sub print_result_input_error_section ($) { |
539 |
|
my $input = shift; |
540 |
|
print STDOUT qq[<div class="section" id="result-summary"> |
541 |
|
<p><em><strong>Input Error</strong>: @{[htescape ($input->{error_status_text})]}</em></p> |
542 |
|
</div>]; |
543 |
|
push @nav, ['#result-summary' => 'Result']; |
544 |
|
} # print_Result_input_error_section |
545 |
|
|
546 |
sub get_node_path ($) { |
sub get_node_path ($) { |
547 |
my $node = shift; |
my $node = shift; |
548 |
my @r; |
my @r; |