5 |
die "$0: No constructor is defined for " . ref $_[0]; |
die "$0: No constructor is defined for " . ref $_[0]; |
6 |
} # new |
} # new |
7 |
|
|
8 |
|
## NOTE: |
9 |
|
## Language ->input, ->output, ->result |
10 |
|
## Input |
11 |
|
## Output ->input |
12 |
|
## Result ->output |
13 |
|
|
14 |
sub input ($;$) { |
sub input ($;$) { |
15 |
if (@_ > 1) { |
if (@_ > 1) { |
16 |
if (defined $_[1]) { |
if (defined $_[1]) { |
60 |
} # onsubdoc |
} # onsubdoc |
61 |
|
|
62 |
sub generate_syntax_error_section ($) { |
sub generate_syntax_error_section ($) { |
63 |
die "$0: Syntactical checking for " . ref $_[0] . " is not supported"; |
die "$0: Syntactical checking for " . (ref $_[0]) . " is not supported"; |
64 |
} # generate_syntax_error_section |
} # generate_syntax_error_section |
65 |
|
|
66 |
sub generate_structure_dump_section ($) { |
sub generate_structure_dump_section ($) { |
72 |
|
|
73 |
my $out = $self->output; |
my $out = $self->output; |
74 |
|
|
75 |
$out->start_section (id => 'document-errors', title => 'Document Errors'); |
$out->start_section (role => 'structure-errors'); |
76 |
$out->html ('<p>Not supported for this kind of contents.'); |
$out->start_error_list (role => 'structure-errors'); |
77 |
## TODO: class="???" |
$self->result->layer_applicable ('structure'); |
78 |
|
|
79 |
|
$self->result->add_error (input => $self->input, |
80 |
|
level => 'u', |
81 |
|
layer => 'structure', |
82 |
|
type => 'media type not supported:structure', |
83 |
|
text => $self->input->{media_type}); |
84 |
|
|
85 |
|
$out->end_error_list (role => 'structure-errors'); |
86 |
$out->end_section; |
$out->end_section; |
87 |
|
|
88 |
|
$self->result->layer_uncertain ('semantics'); |
89 |
} # generate_structure_error_section |
} # generate_structure_error_section |
90 |
|
|
91 |
sub source_charset ($) { |
sub source_charset ($) { |
127 |
|
|
128 |
my $out = $self->output; |
my $out = $self->output; |
129 |
my $i = 1; |
my $i = 1; |
130 |
$out->start_section (id => 'source-string', title => 'Document Source', |
$out->start_section (role => 'source'); |
|
short_title => 'Source'); |
|
131 |
$out->start_tag ('ol', lang => ''); |
$out->start_tag ('ol', lang => ''); |
132 |
|
|
133 |
if (length $$s) { |
if (length $$s) { |
144 |
$out->start_tag ('li', id => 'line-1'); |
$out->start_tag ('li', id => 'line-1'); |
145 |
} |
} |
146 |
$out->end_tag ('ol'); |
$out->end_tag ('ol'); |
147 |
$out->html (qq[<script> |
$out->add_source_to_parse_error_list ('parse-errors-list'); |
148 |
addSourceToParseErrorList ('@{[$input->id_prefix]}', 'parse-errors-list'); |
$out->end_section; |
|
</script>]); |
|
|
$out->end_section |
|
149 |
} # generate_source_string_section |
} # generate_source_string_section |
150 |
|
|
151 |
sub generate_additional_sections ($) { |
sub generate_additional_sections ($) { |
173 |
$out->start_tag ('dt'); |
$out->start_tag ('dt'); |
174 |
$out->url ($url); |
$out->url ($url); |
175 |
$out->start_tag ('dd'); |
$out->start_tag ('dd'); |
176 |
$out->link ('Check conformance of this document', |
$out->link_to_webhacc ('Check conformance of this document', url => $url); |
|
url => _get_cc_url ($url)); |
|
177 |
$out->html ('<dd>Found in: <ul>'); |
$out->html ('<dd>Found in: <ul>'); |
178 |
for my $entry (@{$urls->{$url}}) { |
for my $entry (@{$urls->{$url}}) { |
179 |
$out->html (qq[<li>] . $result->get_node_link ($input, $entry->{node})); |
$out->start_tag ('li'); |
180 |
|
$out->node_link ($entry->{node}); |
181 |
if (keys %{$entry->{type} or {}}) { |
if (keys %{$entry->{type} or {}}) { |
182 |
$out->text (' ('); |
$out->text (' ('); |
183 |
$out->text (join ', ', map { |
$out->text (join ', ', map { |
202 |
$out->end_section; |
$out->end_section; |
203 |
} # generate_url_section |
} # generate_url_section |
204 |
|
|
|
sub _encode_url_component ($) { |
|
|
require Encode; |
|
|
my $s = Encode::encode ('utf8', shift); |
|
|
$s =~ s/([^0-9A-Za-z_.~-])/sprintf '%%%02X', ord $1/ge; |
|
|
return $s; |
|
|
} # _encode_url_component |
|
|
|
|
|
sub _get_cc_url ($) { |
|
|
return './?uri=' . _encode_url_component ($_[0]); |
|
|
} # _get_cc_url |
|
|
|
|
205 |
1; |
1; |