Parent Directory
|
Revision Log
|
Patch
| revision 1.35 by wakaba, Mon Jul 16 03:21:04 2007 UTC | revision 1.106 by wakaba, Sun Mar 9 10:31:19 2008 UTC | |
|---|---|---|
| # | Line 1 | Line 1 |
| 1 | package Whatpm::HTML; | package Whatpm::HTML; |
| 2 | use strict; | use strict; |
| 3 | our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; | our $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
| 4 | use Error qw(:try); | |
| 5 | ||
| 6 | ## ISSUE: | ## ISSUE: |
| 7 | ## var doc = implementation.createDocument (null, null, null); | ## var doc = implementation.createDocument (null, null, null); |
| 8 | ## doc.write (''); | ## doc.write (''); |
| 9 | ## alert (doc.compatMode); | ## alert (doc.compatMode); |
| 10 | ||
| 11 | ## ISSUE: HTML5 revision 967 says that the encoding layer MUST NOT | ## TODO: Control charcters and noncharacters are not allowed (HTML5 revision 1263) |
| 12 | ## strip BOM and the HTML layer MUST ignore it. Whether we can do it | ## TODO: 1252 parse error (revision 1264) |
| 13 | ## is not yet clear. | ## TODO: 8859-11 = 874 (revision 1271) |
| ## "{U+FEFF}..." in UTF-16BE/UTF-16LE is three or four characters? | ||
| ## "{U+FEFF}..." in GB18030? | ||
| 14 | ||
| 15 | my $permitted_slash_tag_name = { | my $permitted_slash_tag_name = { |
| 16 | base => 1, | base => 1, |
| # | Line 19 my $permitted_slash_tag_name = { | Line 18 my $permitted_slash_tag_name = { |
| 18 | meta => 1, | meta => 1, |
| 19 | hr => 1, | hr => 1, |
| 20 | br => 1, | br => 1, |
| 21 | img=> 1, | img => 1, |
| 22 | embed => 1, | embed => 1, |
| 23 | param => 1, | param => 1, |
| 24 | area => 1, | area => 1, |
| # | Line 75 my $special_category = { | Line 74 my $special_category = { |
| 74 | textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, | textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, |
| 75 | }; | }; |
| 76 | my $scoping_category = { | my $scoping_category = { |
| 77 | button => 1, caption => 1, html => 1, marquee => 1, object => 1, | applet => 1, button => 1, caption => 1, html => 1, marquee => 1, object => 1, |
| 78 | table => 1, td => 1, th => 1, | table => 1, td => 1, th => 1, |
| 79 | }; | }; |
| 80 | my $formatting_category = { | my $formatting_category = { |
| # | Line 84 my $formatting_category = { | Line 83 my $formatting_category = { |
| 83 | }; | }; |
| 84 | # $phrasing_category: all other elements | # $phrasing_category: all other elements |
| 85 | ||
| 86 | sub parse_byte_string ($$$$;$) { | |
| 87 | my $self = ref $_[0] ? shift : shift->new; | |
| 88 | my $charset = shift; | |
| 89 | my $bytes_s = ref $_[0] ? $_[0] : \($_[0]); | |
| 90 | my $s; | |
| 91 | ||
| 92 | if (defined $charset) { | <