Parent Directory
|
Revision Log
|
Patch
| revision 1.10 by wakaba, Sat Jun 23 03:30:06 2007 UTC | revision 1.98 by wakaba, Sun Mar 9 03:23:43 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 | ## This is an early version of an HTML parser. | ## ISSUE: |
| 7 | ## var doc = implementation.createDocument (null, null, null); | |
| 8 | ## doc.write (''); | |
| 9 | ## alert (doc.compatMode); | |
| 10 | ||
| 11 | ## TODO: Control charcters and noncharacters are not allowed (HTML5 revision 1263) | |
| 12 | ## TODO: 1252 parse error (revision 1264) | |
| 13 | ## TODO: 8859-11 = 874 (revision 1271) | |
| 14 | ||
| 15 | my $permitted_slash_tag_name = { | my $permitted_slash_tag_name = { |
| 16 | base => 1, | base => 1, |
| # | Line 10 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 18 my $permitted_slash_tag_name = { | Line 26 my $permitted_slash_tag_name = { |
| 26 | input => 1, | input => 1, |
| 27 | }; | }; |
| 28 | ||
| my $entity_char = { | ||
| AElig => "\x{00C6}", | ||
| Aacute => "\x{00C1}", | ||
| Acirc => "\x{00C2}", | ||
| Agrave => "\x{00C0}", | ||
| Alpha => "\x{0391}", | ||
| Aring => "\x{00C5}", | ||
| Atilde => "\x{00C3}", | ||
| Auml => "\x{00C4}", | ||
| Beta => "\x{0392}", | ||
| Ccedil => "\x{00C7}", | ||
| Chi => "\x{03A7}", | ||
| Dagger => "\x{2021}", | ||
| Delta => "\x{0394}", | ||
| ETH => "\x{00D0}", | ||
| Eacute => "\x{00C9}", | ||
| Ecirc => "\x{00CA}", | ||
| Egrave => "\x{00C8}", | ||
| Epsilon => "\x{0395}", | ||
| Eta => "\x{0397}", | ||
| Euml => "\x{00CB}", | ||
| Gamma => "\x{0393}", | ||
| Iacute => "\x{00CD}", | ||
| Icirc => "\x{00CE}", | ||
| Igrave => "\x{00CC}", | ||
| Iota => "\x{0399}", | ||
| Iuml => "\x{00CF}", | ||
| Kappa => "\x{039A}", | ||
| Lambda => "\x{039B}", | ||
| Mu => "\x{039C}", | ||
| Ntilde => "\x{00D1}", | ||
| Nu => "\x{039D}", | ||
| OElig => "\x{0152}", | ||
| Oacute => "\x{00D3}", | ||
| Ocirc => "\x{00D4}", | ||
| Ograve => "\x{00D2}", | ||
| Omega => "\x{03A9}", | ||
| Omicron => "\x{039F}", | ||
| Oslash => "\x{00D8}", | ||
| Otilde => "\x{00D5}", | ||
| Ouml => "\x{00D6}", | ||
| Phi => "\x{03A6}", | ||
| Pi => "\x{03A0}", | ||
| Prime => "\x{2033}", | ||
| Psi => "\x{03A8}", | ||
| Rho => "\x{03A1}", | ||
| Scaron => "\x{0160}", | ||
| Sigma => "\x{03A3}", | ||
| THORN => "\x{00DE}", | ||
| Tau => "\x{03A4}", | ||
| Theta => "\x{0398}", | ||
| Uacute => "\x{00DA}", | ||
| Ucirc => "\x{00DB}", | ||
| Ugrave => "\x{00D9}", | ||
| Upsilon => "\x{03A5}", | ||
| Uuml => "\x{00DC}", | ||
| Xi => "\x{039E}", | ||
| Yacute => "\x{00DD}", | ||
| Yuml => "\x{0178}", | ||
| Zeta => "\x{0396}", | ||
| aacute => "\x{00E1}", | ||
| acirc => "\x{00E2}", | ||
| acute => "\x{00B4}", | ||
| aelig => "\x{00E6}", | ||
| agrave => "\x{00E0}", | ||
| alefsym => "\x{2135}", | ||
| alpha => "\x{03B1}", | ||
| amp => "\x{0026}", | ||
| AMP => "\x{0026}", | ||
| and => "\x{2227}", | ||
| ang => "\x{2220}", | ||
| apos => "\x{0027}", | ||
| aring => "\x{00E5}", | ||
| asymp => "\x{2248}", | ||
| atilde => "\x{00E3}", | ||
| auml => "\x{00E4}", | ||
| bdquo => "\x{201E}", | ||
| beta => "\x{03B2}", | ||
| brvbar => "\x{00A6}", | ||
| bull => "\x{2022}", | ||
| cap => "\x{2229}", | ||
| ccedil => "\x{00E7}", | ||
| cedil => "\x{00B8}", | ||
| cent => "\x{00A2}", | ||
| chi => "\x{03C7}", | ||
| circ => "\x{02C6}", | ||
| clubs => "\x{2663}", | ||
| cong => "\x{2245}", | ||
| copy => "\x{00A9}", | ||
| COPY => "\x{00A9}", | ||
| crarr => "\x{21B5}", | ||
| cup => "\x{222A}", | ||
| curren => "\x{00A4}&q |