189 |
require Whatpm::ContentChecker; |
require Whatpm::ContentChecker; |
190 |
my $onerror = sub { |
my $onerror = sub { |
191 |
my %opt = @_; |
my %opt = @_; |
192 |
print STDOUT qq[<dt><a href="#node-@{[refaddr $opt{node}]}">], |
print STDOUT qq[<dt>] . get_node_link ($opt{node}) . |
193 |
htescape get_node_path ($opt{node}), |
"</dt>\n<dd>", htescape $opt{type}, "</dd>\n"; |
|
"</a></dt>\n<dd>", htescape $opt{type}, "</dd>\n"; |
|
194 |
}; |
}; |
195 |
|
|
196 |
my $elements; |
my $elements; |
222 |
my $i = 0; |
my $i = 0; |
223 |
for my $table_el (@{$elements->{table}}) { |
for my $table_el (@{$elements->{table}}) { |
224 |
$i++; |
$i++; |
225 |
print STDOUT qq[<div class="section" id="table-$i"><h3>]; |
print STDOUT qq[<div class="section" id="table-$i"><h3>] . |
226 |
print STDOUT qq[<a href="#node-@{[refaddr $table_el]}">], |
get_node_link ($table_el) . q[</h3>]; |
|
htescape get_node_path ($table_el); |
|
|
print STDOUT qq[</a></h3>\n]; |
|
227 |
|
|
228 |
my $table = Whatpm::HTMLTable->form_table ($table_el); |
my $table = Whatpm::HTMLTable->form_table ($table_el); |
229 |
|
|
257 |
|
|
258 |
print STDOUT qq[</div>]; |
print STDOUT qq[</div>]; |
259 |
} |
} |
260 |
|
|
261 |
|
if (keys %{$elements->{term}}) { |
262 |
|
print STDOUT qq[ |
263 |
|
<div id="terms" class="section"> |
264 |
|
<h2>Terms</h2> |
265 |
|
|
266 |
|
<dl> |
267 |
|
]; |
268 |
|
for my $term (sort {$a cmp $b} keys %{$elements->{term}}) { |
269 |
|
print STDOUT qq[<dt>@{[htescape $term]}</dt>]; |
270 |
|
for (@{$elements->{term}->{$term}}) { |
271 |
|
print STDOUT qq[<dd>].get_node_link ($_).qq[</dd>]; |
272 |
|
} |
273 |
|
} |
274 |
|
print STDOUT qq[</dl></div>]; |
275 |
|
} |
276 |
} |
} |
277 |
|
|
278 |
## TODO: Show result |
## TODO: Show result |
336 |
|
|
337 |
if ($node->has_child_nodes) { |
if ($node->has_child_nodes) { |
338 |
$r .= '<ol class="children">'; |
$r .= '<ol class="children">'; |
339 |
unshift @node, @{$child->child_nodes}, '</ol>'; |
unshift @node, @{$child->child_nodes}, '</ol></li>'; |
340 |
|
} else { |
341 |
|
$r .= '</li>'; |
342 |
} |
} |
343 |
} elsif ($nt == $child->TEXT_NODE) { |
} elsif ($nt == $child->TEXT_NODE) { |
344 |
$r .= qq'<li id="$node_id" class="tree-text"><q lang="">' . htescape ($child->data) . '</q></li>'; |
$r .= qq'<li id="$node_id" class="tree-text"><q lang="">' . htescape ($child->data) . '</q></li>'; |
347 |
} elsif ($nt == $child->COMMENT_NODE) { |
} elsif ($nt == $child->COMMENT_NODE) { |
348 |
$r .= qq'<li id="$node_id" class="tree-comment"><code><!--</code><q lang="">' . htescape ($child->data) . '</q><code>--></code></li>'; |
$r .= qq'<li id="$node_id" class="tree-comment"><code><!--</code><q lang="">' . htescape ($child->data) . '</q><code>--></code></li>'; |
349 |
} elsif ($nt == $child->DOCUMENT_NODE) { |
} elsif ($nt == $child->DOCUMENT_NODE) { |
350 |
$r .= qq'<li id="$node_id" class="tree-document">Document</li>'; |
$r .= qq'<li id="$node_id" class="tree-document">Document'; |
351 |
if ($child->has_child_nodes) { |
if ($child->has_child_nodes) { |
352 |
$r .= '<ol>'; |
$r .= '<ol>'; |
353 |
unshift @node, @{$child->child_nodes}, '</ol>'; |
unshift @node, @{$child->child_nodes}, '</ol></li>'; |
354 |
} |
} |
355 |
} elsif ($nt == $child->DOCUMENT_TYPE_NODE) { |
} elsif ($nt == $child->DOCUMENT_TYPE_NODE) { |
356 |
$r .= qq'<li id="$node_id" class="tree-doctype"><code><!DOCTYPE></code><ul class="attributes">'; |
$r .= qq'<li id="$node_id" class="tree-doctype"><code><!DOCTYPE></code><ul class="attributes">'; |
395 |
return join '/', @r; |
return join '/', @r; |
396 |
} # get_node_path |
} # get_node_path |
397 |
|
|
398 |
|
sub get_node_link ($) { |
399 |
|
return qq[<a href="#node-@{[refaddr $_[0]]}">] . |
400 |
|
htescape (get_node_path ($_[0])) . qq[</a>]; |
401 |
|
} # get_node_link |
402 |
|
|
403 |
=head1 AUTHOR |
=head1 AUTHOR |
404 |
|
|
405 |
Wakaba <w@suika.fam.cx>. |
Wakaba <w@suika.fam.cx>. |