Parent Directory
|
Revision Log
++ whatpm/t/ChangeLog 16 Jul 2007 04:51:17 -0000 * tree-test-1.dat: Tests for |<html>| in trailing end phase and |</frameset>| in after frameset mode are added. * tree-test-2.dat: Tests for |</frameset>| in |frameset| fragment parsing are added. 2007-07-16 Wakaba <wakaba@suika.fam.cx> ++ whatpm/Whatpm/ChangeLog 16 Jul 2007 04:49:33 -0000 * HTML.pm.src (main and trailin end phases): Token types |DOCTYPE|, |comment|, |end-of-file|, and |<html>| are factored out. Error types |in html:#DOCTYPE| and |after html:#DOCTYPE| are merged into |DOCTYPE in the middle|. |</frameset>| in fragment parsing mode changed the insertion mode. 2007-07-16 Wakaba <wakaba@suika.fam.cx>
| 1 | package Whatpm::HTML; |
| 2 | use strict; |
| 3 | our $VERSION=do{my @r=(q$Revision: 1.35 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
| 4 | |
| 5 | ## ISSUE: |
| 6 | ## var doc = implementation.createDocument (null, null, null); |
| 7 | ## doc.write (''); |
| 8 | ## alert (doc.compatMode); |
| 9 | |
| 10 | ## ISSUE: HTML5 revision 967 says that the encoding layer MUST NOT |
| 11 | ## strip BOM and the HTML layer MUST ignore it. Whether we can do it |
| 12 | ## is not yet clear. |
| 13 | ## "{U+FEFF}..." in UTF-16BE/UTF-16LE is three or four characters? |
| 14 | ## "{U+FEFF}..." in GB18030? |
| 15 | |
| 16 | my $permitted_slash_tag_name = { |
| 17 | base => 1, |
| 18 | link => 1, |
| 19 | meta => 1, |
| 20 | hr => 1, |
| 21 | br => 1, |
| 22 | img=> 1, |
| 23 | embed => 1, |
| 24 | param => 1, |
| 25 | area => 1, |
| 26 | col => 1, |
| 27 | input => 1, |
| 28 | }; |
| 29 | |
| 30 | my $c1_entity_char = { |
| 31 | 0x80 => 0x20AC, |
| 32 | 0x81 => 0xFFFD, |
| 33 | 0x82 => 0x201A, |
| 34 | 0x83 => 0x0192, |
| 35 | 0x84 => 0x201E, |
| 36 | 0x85 => 0x2026, |
| 37 | 0x86 => 0x2020, |
| 38 | 0x87 => 0x2021, |
| 39 | 0x88 => 0x02C6, |
| 40 | 0x89 => 0x2030, |
| 41 | 0x8A => 0x0160, |
| 42 | 0x8B => 0x2039, |
| 43 | 0x8C => 0x0152, |
| 44 | 0x8D => 0xFFFD, |
| 45 | 0x8E => 0x017D, |
| 46 | 0x8F => 0xFFFD, |
| 47 | 0x90 => 0xFFFD, |
| 48 | 0x91 => 0x2018, |
| 49 | 0x92 => 0x2019, |
| 50 | 0x93 => 0x201C, |
| 51 | 0x94 => 0x201D, |
| 52 | 0x95 => 0x2022, |
| 53 | 0x96 => 0x2013, |
| 54 | 0x97 => 0x2014, |
| 55 | 0x98 => 0x02DC, |
| 56 | 0x99 => 0x2122, |
| 57 | 0x9A => 0x0161, |
| 58 | 0x9B => 0x203A, |
| 59 | 0x9C => 0x0153, |
| 60 | 0x9D => 0xFFFD, |
| 61 | 0x9E => 0x017E, |
| 62 | 0x9F => 0x0178, |
| 63 | }; # $c1_entity_char |
| 64 | |
| 65 | my $special_category = { |
| 66 | address => 1, area => 1, base => 1, basefont => 1, bgsound => 1, |
| 67 | blockquote => 1, body => 1, br => 1, center => 1, col => 1, colgroup => 1, |
| 68 | dd => 1, dir => 1, div => 1, dl => 1, dt => 1, embed => 1, fieldset => 1, |
| 69 | form => 1, frame => 1, frameset => 1, h1 => 1, h2 => 1, h3 => 1, |
| 70 | h4 => 1, h5 => 1, h6 => 1, head => 1, hr => 1, iframe => 1, image => 1, |
| 71 | img => 1, input => 1, isindex => 1, li => 1, link => 1, listing => 1, |
| 72 | menu => 1, meta => 1, noembed => 1, noframes => 1, noscript => 1, |
| 73 | ol => 1, optgroup => 1, option => 1, p => 1, param => 1, plaintext => 1, |
| 74 | pre => 1, script => 1, select => 1, spacer => 1, style => 1, tbody => 1, |
| 75 | textarea => 1, tfoot => 1, thead => 1, title => 1, tr => 1, ul => 1, wbr => 1, |
| 76 | }; |
| 77 | my $scoping_category = { |
| 78 | button => 1, caption => 1, html => 1, marquee => 1, object => 1, |
| 79 | table => 1, td => 1, th => 1, |
| 80 | }; |
| 81 | my $formatting_category = { |
| 82 | a => 1, b => 1, big => 1, em => 1, font => 1, i => 1, nobr => 1, |
| 83 | s => 1, small => 1, strile => 1, strong => 1, tt => 1, u => 1, |
| 84 |