| 1 |
package WebHACC::Language::CSS; |
package WebHACC::Language::CSS; |
| 2 |
use strict; |
use strict; |
| 3 |
require WebHACC::Langauge::Base; |
require WebHACC::Language::Base; |
| 4 |
push our @ISA, 'WebHACC::Language::Base'; |
push our @ISA, 'WebHACC::Language::Base'; |
| 5 |
|
|
| 6 |
sub new ($) { |
sub new ($) { |
| 10 |
|
|
| 11 |
sub generate_syntax_error_section ($) { |
sub generate_syntax_error_section ($) { |
| 12 |
my $self = shift; |
my $self = shift; |
| 13 |
|
|
| 14 |
my $out = $self->output; |
my $out = $self->output; |
| 15 |
$out->start_section (id => 'parse-errors', title => 'Parse Errors'); |
|
| 16 |
$out->start_tag ('dl', id => 'parse-errors-list'); |
$self->result->layer_uncertain ('charset'); |
| 17 |
|
|
| 18 |
|
$out->start_section (role => 'parse-errors'); |
| 19 |
|
$out->start_error_list (role => 'parse-errors'); |
| 20 |
|
$self->result->layer_applicable ('syntax'); |
| 21 |
|
|
| 22 |
my $input = $self->input; |
my $input = $self->input; |
| 23 |
my $result = $self->result; |
my $result = $self->result; |
| 31 |
} |
} |
| 32 |
$result->add_error (%opt, layer => 'syntax'); |
$result->add_error (%opt, layer => 'syntax'); |
| 33 |
}; |
}; |
| 34 |
$p->{href} = $input->{uri}; |
$p->{href} = $input->url; |
| 35 |
$p->{base_uri} = $input->{base_uri}; |
$p->{base_uri} = $input->{base_uri}; |
| 36 |
|
|
| 37 |
# if ($parse_mode eq 'q') { |
# if ($parse_mode eq 'q') { |
| 44 |
my $s = \$input->{s}; |
my $s = \$input->{s}; |
| 45 |
my $charset; |
my $charset; |
| 46 |
unless ($input->{is_char_string}) { |
unless ($input->{is_char_string}) { |
| 47 |
|
$self->result->layer_uncertain ('encode'); |
| 48 |
require Encode; |
require Encode; |
| 49 |
if (defined $input->{charset}) {## TODO: IANA->Perl |
if (defined $input->{charset}) {## TODO: IANA->Perl |
| 50 |
$charset = $input->{charset}; |
$charset = $input->{charset}; |
| 58 |
$self->{structure} = $p->parse_char_string ($$s); |
$self->{structure} = $p->parse_char_string ($$s); |
| 59 |
$self->{structure}->manakai_input_encoding ($charset) if defined $charset; |
$self->{structure}->manakai_input_encoding ($charset) if defined $charset; |
| 60 |
|
|
| 61 |
$out->end_tag ('dl'); |
$out->end_error_list (role => 'parse-errors'); |
| 62 |
$out->end_section; |
$out->end_section; |
| 63 |
} # generate_syntax_error_section |
} # generate_syntax_error_section |
| 64 |
|
|
| 69 |
sub generate_structure_dump_section ($) { |
sub generate_structure_dump_section ($) { |
| 70 |
my $self = shift; |
my $self = shift; |
| 71 |
|
|
| 72 |
my $out = $self->input; |
my $out = $self->output; |
| 73 |
$out->start_section (id => 'document-tree', title => 'Document Tree', |
|
| 74 |
short_title => 'Tree'); |
$out->start_section (role => 'reformatted'); |
| 75 |
|
|
| 76 |
$out->start_code_block; |
$out->start_code_block; |
| 77 |
$out->text ($cssom->css_text); |
$out->text ($self->{structure}->css_text); |
| 78 |
$out->end_code_block; |
$out->end_code_block; |
| 79 |
|
|
| 80 |
$out->end_section; |
$out->end_section; |
| 85 |
|
|
| 86 |
my $out = $self->output; |
my $out = $self->output; |
| 87 |
|
|
| 88 |
$out->start_section (id => 'document-errors', title => 'Document Errors'); |
$out->start_section (role => 'structure-errors'); |
| 89 |
$out->start_tag ('dl', class => 'document-errors-list'); |
$out->start_error_list (role => 'structure-errors'); |
| 90 |
|
$self->result->layer_applicable ('structure'); |
| 91 |
|
|
| 92 |
$self->result->add_error (level => 'u', |
$self->result->add_error (level => 'u', |
| 93 |
layer => 'structure', |
layer => 'structure', |
| 94 |
|
input => $self->input, |
| 95 |
type => 'CSSOM validation not supported'); |
type => 'CSSOM validation not supported'); |
| 96 |
|
|
| 97 |
$out->end_tag ('dl'); |
$out->end_error_list (role => 'structure-errors'); |
| 98 |
$out->end_section; |
$out->end_section; |
| 99 |
} # generate_structure_error_section |
} # generate_structure_error_section |
| 100 |
|
|