Parent Directory
|
Revision Log
++ whatpm/What/ChangeLog 1 May 2007 06:20:06 -0000 2007-05-01 Wakaba <wakaba@suika.fam.cx> * NanoDOM.pm (last_child, previous_sibling): New attributes. (clone_node): Attribute nodes were not completely copied. * HTML.pm.src: Many bugs are fixed. ++ whatpm/t/ChangeLog 1 May 2007 06:21:52 -0000 2007-05-01 Wakaba <wakaba@suika.fam.cx> * HTML-tree.t: New test file is added. Sort key was incorrect. * HTML-tokenizer.t: New test file is added. * tokenizer-test-1.test, tree-test-1.dat: New tests.
| 1 | wakaba | 1.1 | package What::HTML; |
| 2 | use strict; | ||
| 3 | wakaba | 1.7 | our $VERSION=do{my @r=(q$Revision: 1.6 $=~/\d+/g);sprintf "%d."."%02d" x $#r,@r}; |
| 4 | wakaba | 1.1 | |
| 5 | ## This is a very, very early version of an HTML parser. | ||
| 6 | |||
| 7 | my $permitted_slash_tag_name = { | ||
| 8 | base => 1, | ||
| 9 | link => 1, | ||
| 10 | meta => 1, | ||
| 11 | hr => 1, | ||
| 12 | br => 1, | ||
| 13 | img=> 1, | ||
| 14 | embed => 1, | ||
| 15 | param => 1, | ||
| 16 | area => 1, | ||
| 17 | col => 1, | ||
| 18 | input => 1, | ||
| 19 | }; | ||
| 20 | |||
| 21 | wakaba | 1.5 | my $entity_char = { |
| 22 | AElig => "\x{00C6}", | ||
| 23 | Aacute => "\x{00C1}", | ||
| 24 | Acirc => "\x{00C2}", | ||
| 25 | Agrave => "\x{00C0}", | ||
| 26 | Alpha => "\x{0391}", | ||
| 27 | Aring => "\x{00C5}", | ||
| 28 | Atilde => "\x{00C3}", | ||
| 29 | Auml => "\x{00C4}", | ||
| 30 | Beta => "\x{0392}", | ||
| 31 | Ccedil => "\x{00C7}", | ||
| 32 | Chi => "\x{03A7}", | ||
| 33 | Dagger => "\x{2021}", | ||
| 34 | Delta => "\x{0394}", | ||
| 35 | ETH => "\x{00D0}", | ||
| 36 | Eacute => "\x{00C9}", | ||
| 37 | Ecirc => "\x{00CA}", | ||
| 38 | Egrave => "\x{00C8}", | ||
| 39 | Epsilon => "\x{0395}", | ||
| 40 | Eta => "\x{0397}", | ||
| 41 | Euml => "\x{00CB}", | ||
| 42 | Gamma => "\x{0393}", | ||
| 43 | Iacute => "\x{00CD}", | ||
| 44 | Icirc => "\x{00CE}", | ||
| 45 | Igrave => "\x{00CC}", | ||
| 46 | Iota => "\x{0399}", | ||
| 47 | Iuml => "\x{00CF}", | ||
| 48 | Kappa => "\x{039A}", | ||
| 49 | Lambda => "\x{039B}", | ||
| 50 | Mu => "\x{039C}", | ||
| 51 | Ntilde => "\x{00D1}", | ||
| 52 | Nu => "\x{039D}", | ||
| 53 | OElig => "\x{0152}", | ||
| 54 | Oacute => "\x{00D3}", | ||
| 55 | Ocirc => "\x{00D4}", | ||
| 56 | Ograve => "\x{00D2}", | ||
| 57 | Omega => "\x{03A9}", | ||
| 58 | Omicron => "\x{039F}", | ||
| 59 | Oslash => "\x{00D8}", | ||
| 60 | Otilde => "\x{00D5}", | ||
| 61 | Ouml => "\x{00D6}", | ||
| 62 | Phi => "\x{03A6}", | ||
| 63 | Pi => "\x{03A0}", | ||
| 64 | Prime => "\x{2033}", | ||
| 65 | Psi => "\x{03A8}", | ||
| 66 | Rho => "\x{03A1}", | ||
| 67 | Scaron => "\x{0160}", | ||
| 68 | Sigma => "\x{03A3}", | ||
| 69 | THORN => "\x{00DE}", | ||
| 70 | Tau => "\x{03A4}", | ||
| 71 | Theta => "\x{0398}", | ||
| 72 | Uacute => "\x{00DA}", | ||
| 73 | Ucirc => "\x{00DB}", | ||
| 74 | Ugrave => "\x{00D9}", | ||
| 75 | Upsilon => "\x{03A5}", | ||
| 76 | Uuml => "\x{00DC}", | ||
| 77 | Xi => "\x{039E}", | ||
| 78 | Yacute => "\x{00DD}", | ||
| 79 | Yuml => "\x{0178}", | ||
| 80 | Zeta => "\x{0396}", | ||
| 81 | aacute => "\x{00E1}", | ||
| 82 | acirc => "\x{00E2}", | ||
| 83 | acute => "\x{00B4}", | ||
| 84 | aelig => "\x{00E6}", | ||
| 85 | agrave => "\x{00E0}", | ||
| 86 | alefsym => "\x{2135}", | ||
| 87 | alpha => "\x{03B1}", | ||