/[suikacvs]/test/html-webhacc/WebHACC/Language/HTML.pm
Suika

Contents of /test/html-webhacc/WebHACC/Language/HTML.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Fri Aug 15 05:53:23 2008 UTC (16 years, 10 months ago) by wakaba
Branch: MAIN
Changes since 1.5: +2 -1 lines
++ ChangeLog	15 Aug 2008 05:43:43 -0000
2008-08-15  Wakaba  <wakaba@suika.fam.cx>

	* cc-style.css: Add icons to links and headings of error sections.
	Use standard "uncertain" color for level-u errors.  "No error found"
	messages are now handled by catalog, not by CSS presentation.
	The result paragraph saying that the conformance is unknown
	should be bordered as uncertain error messages are.

	* error-description-source.xml: New message entries
	for not-translated-yet messages.  Distinguish result table's
	layer names from other similar texts.

++ html/WebHACC/Language/ChangeLog	15 Aug 2008 05:53:19 -0000
2008-08-15  Wakaba  <wakaba@suika.fam.cx>

	* CSS.pm, CacheManifest.pm, HTML.pm, WebIDL.pm, XML.pm: Don't
	set "uncertain" flag to character encoding (encode) layer if the
	input is a character string.

++ html/WebHACC/ChangeLog	15 Aug 2008 05:51:54 -0000
2008-08-15  Wakaba  <wakaba@suika.fam.cx>

	* Input.pm (generate_transfer_sections): Use standard
	error list methods for transfer errors.  Typos fixed.

	* Output.pm (has_error): New attribute.
	(start_error_list, end_error_list): Support for role "transfer-errors".
	(end_error_list): Generate "no error found" paragraph if it should be.
	(generate_input_section): Decode parameters as UTF-8.

	* Result.pm (add_error): Set |has_error| flag.  Use catalog
	for "Unknown location" message.
	(generate_result_section): Use different text for
	result table rows than normal messages, to avoid collision
	with other messages (such as "Charset").

1 wakaba 1.1 package WebHACC::Language::HTML;
2     use strict;
3     require WebHACC::Language::DOM;
4     push our @ISA, 'WebHACC::Language::DOM';
5    
6     sub new ($) {
7     return bless {}, shift;
8     } # new
9    
10     sub generate_syntax_error_section ($) {
11     my $self = shift;
12    
13 wakaba 1.4 require Message::DOM::DOMImplementation;
14 wakaba 1.1 require Encode;
15     require Whatpm::HTML;
16    
17 wakaba 1.5 $self->result->layer_uncertain ('charset');
18    
19 wakaba 1.1 my $out = $self->output;
20 wakaba 1.3 $out->start_section (role => 'parse-errors');
21     $out->start_error_list (role => 'parse-errors');
22 wakaba 1.5 $self->result->layer_applicable ('syntax');
23 wakaba 1.1
24     my $input = $self->input;
25     my $result = $self->result;
26    
27     my $onerror = sub {
28 wakaba 1.2 $result->add_error (@_, layer => 'syntax');
29 wakaba 1.1 };
30    
31     my $dom = Message::DOM::DOMImplementation->new;
32     my $doc = $dom->create_document;
33     my $el;
34     my $inner_html_element = $input->{inner_html_element};
35     if (defined $inner_html_element and length $inner_html_element) {
36     $input->{charset} ||= 'windows-1252'; ## TODO: for now.
37     my $t = \($input->{s});
38     unless ($input->{is_char_string}) {
39     $t = \(Encode::decode ($input->{charset}, $$t));
40 wakaba 1.6 $self->result->layer_uncertain ('encode');
41 wakaba 1.1 }
42    
43     $el = $doc->create_element_ns
44     ('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]);
45     Whatpm::HTML->set_inner_html ($el, $$t, $onerror);
46    
47     $self->{structure} = $el;
48     } else {
49     if ($input->{is_char_string}) {
50     Whatpm::HTML->parse_char_string ($input->{s} => $doc, $onerror);
51     } else {
52     Whatpm::HTML->parse_byte_string
53     ($input->{charset}, $input->{s} => $doc, $onerror);
54 wakaba 1.6 $self->result->layer_uncertain ('encode');
55 wakaba 1.1 }
56    
57     $self->{structure} = $doc;
58     }
59     $doc->manakai_charset ($input->{official_charset})
60     if defined $input->{official_charset};
61    
62     $doc->document_uri ($input->{uri});
63     $doc->manakai_entity_base_uri ($input->{base_uri});
64    
65 wakaba 1.3 $out->end_error_list (role => 'parse-errors');
66 wakaba 1.1 $out->end_section;
67     } # generate_syntax_error_section
68    
69     sub source_charset ($) {
70     my $self = shift;
71     return $self->input->{charset} || ($self->{structure}->owner_document || $self->{structure})->input_encoding;
72     ## TODO: Can we always use input_encoding?
73     } # source_charset
74    
75     1;

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24