| 155 |
my $doc; |
my $doc; |
| 156 |
my $el; |
my $el; |
| 157 |
my $manifest; |
my $manifest; |
| 158 |
|
my @subdoc; |
| 159 |
|
|
| 160 |
if ($input->{media_type} eq 'text/html') { |
if ($input->{media_type} eq 'text/html') { |
| 161 |
($doc, $el) = print_syntax_error_html_section ($input, $result); |
($doc, $el) = print_syntax_error_html_section ($input, $result); |
| 181 |
} |
} |
| 182 |
|
|
| 183 |
if (defined $doc or defined $el) { |
if (defined $doc or defined $el) { |
| 184 |
|
$doc->document_uri ($input->{uri}); |
| 185 |
|
$doc->manakai_entity_base_uri ($input->{base_uri}); |
| 186 |
print_structure_dump_dom_section ($input, $doc, $el); |
print_structure_dump_dom_section ($input, $doc, $el); |
| 187 |
my $elements = print_structure_error_dom_section |
my $elements = print_structure_error_dom_section |
| 188 |
($input, $doc, $el, $result); |
($input, $doc, $el, $result, sub { |
| 189 |
|
push @subdoc, shift; |
| 190 |
|
}); |
| 191 |
print_table_section ($input, $elements->{table}) if @{$elements->{table}}; |
print_table_section ($input, $elements->{table}) if @{$elements->{table}}; |
| 192 |
print_listing_section ({ |
print_listing_section ({ |
| 193 |
id => 'identifiers', label => 'IDs', heading => 'Identifiers', |
id => 'identifiers', label => 'IDs', heading => 'Identifiers', |
| 202 |
print_structure_dump_manifest_section ($input, $manifest); |
print_structure_dump_manifest_section ($input, $manifest); |
| 203 |
print_structure_error_manifest_section ($input, $manifest, $result); |
print_structure_error_manifest_section ($input, $manifest, $result); |
| 204 |
} |
} |
| 205 |
|
|
| 206 |
|
my $id_prefix = 0; |
| 207 |
|
for my $subinput (@subdoc) { |
| 208 |
|
$subinput->{id_prefix} = 'subdoc-' . ++$id_prefix; |
| 209 |
|
$subinput->{nested} = 1; |
| 210 |
|
$subinput->{base_uri} = $subinput->{container_node}->base_uri |
| 211 |
|
unless defined $subinput->{base_uri}; |
| 212 |
|
my $ebaseuri = htescape ($subinput->{base_uri}); |
| 213 |
|
push @nav, ['#' . $subinput->{id_prefix} => 'Sub #' . $id_prefix]; |
| 214 |
|
print STDOUT qq[<div id="$subinput->{id_prefix}" class=section> |
| 215 |
|
<h2>Subdocument #$id_prefix</h2> |
| 216 |
|
|
| 217 |
|
<dl> |
| 218 |
|
<dt>Internet Media Type</dt> |
| 219 |
|
<dd><code class="MIME" lang="en">@{[htescape $subinput->{media_type}]}</code> |
| 220 |
|
<dt>Container Node</dt> |
| 221 |
|
<dd>@{[get_node_link ($input, $subinput->{container_node})]}</dd> |
| 222 |
|
<dt>Base <abbr title="Uniform Resource Identifiers">URI</abbr></dt> |
| 223 |
|
<dd><code class=URI><<a href="$ebaseuri">$ebaseuri</a>></code></dd> |
| 224 |
|
</dl>]; |
| 225 |
|
|
| 226 |
|
check_and_print ($subinput => $result); |
| 227 |
|
|
| 228 |
|
print STDOUT qq[</div>]; |
| 229 |
|
} |
| 230 |
} # check_and_print |
} # check_and_print |
| 231 |
|
|
| 232 |
sub print_http_header_section ($$) { |
sub print_http_header_section ($$) { |
| 233 |
my ($input, $result) = @_; |
my ($input, $result) = @_; |
| 234 |
return unless defined $input->{header_status_code} or |
return unless defined $input->{header_status_code} or |
| 235 |
defined $input->{header_status_text} or |
defined $input->{header_status_text} or |
| 236 |
@{$input->{header_field}}; |
@{$input->{header_field} or []}; |
| 237 |
|
|
| 238 |
push @nav, ['#source-header' => 'HTTP Header'] unless $input->{nested}; |
push @nav, ['#source-header' => 'HTTP Header'] unless $input->{nested}; |
| 239 |
print STDOUT qq[<div id="$input->{id_prefix}source-header" class="section"> |
print STDOUT qq[<div id="$input->{id_prefix}source-header" class="section"> |
| 567 |
print STDOUT qq[</dl></div>]; |
print STDOUT qq[</dl></div>]; |
| 568 |
} # print_structure_dump_manifest_section |
} # print_structure_dump_manifest_section |
| 569 |
|
|
| 570 |
sub print_structure_error_dom_section ($$$$) { |
sub print_structure_error_dom_section ($$$$$) { |
| 571 |
my ($input, $doc, $el, $result) = @_; |
my ($input, $doc, $el, $result, $onsubdoc) = @_; |
| 572 |
|
|
| 573 |
print STDOUT qq[<div id="$input->{id_prefix}document-errors" class="section"> |
print STDOUT qq[<div id="$input->{id_prefix}document-errors" class="section"> |
| 574 |
<h2>Document Errors</h2> |
<h2>Document Errors</h2> |
| 592 |
my $elements; |
my $elements; |
| 593 |
my $time1 = time; |
my $time1 = time; |
| 594 |
if ($el) { |
if ($el) { |
| 595 |
$elements = Whatpm::ContentChecker->check_element ($el, $onerror); |
$elements = Whatpm::ContentChecker->check_element |
| 596 |
|
($el, $onerror, $onsubdoc); |
| 597 |
} else { |
} else { |
| 598 |
$elements = Whatpm::ContentChecker->check_document ($doc, $onerror); |
$elements = Whatpm::ContentChecker->check_document |
| 599 |
|
($doc, $onerror, $onsubdoc); |
| 600 |
} |
} |
| 601 |
$time{check} = time - $time1; |
$time{check} = time - $time1; |
| 602 |
|
|