Parent Directory
|
Revision Log
|
Patch
| revision 1.16 by wakaba, Sat Jun 23 07:42:11 2007 UTC | revision 1.215 by wakaba, Thu Jul 2 22:11:51 2009 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. | use Whatpm::HTML::Tokenizer; |
| 7 | ||
| 8 | my $permitted_slash_tag_name = { | ## NOTE: This module don't check all HTML5 parse errors; character |
| 9 | base => 1, | ## encoding related parse errors are expected to be handled by relevant |
| 10 | link => 1, | ## modules. |
| 11 | meta => 1, | ## Parse errors for control characters that are not allowed in HTML5 |
| 12 | hr => 1, | ## documents, for surrogate code points, and for noncharacter code |
| 13 | br => 1, | ## points, as well as U+FFFD substitions for characters whose code points |
| 14 | img=> 1, | ## is higher than U+10FFFF may be detected by combining the parser with |
| 15 | embed => 1, | ## the checker implemented by Whatpm::Charset::UnicodeChecker (for its |
| 16 | param => 1, | ## usage example, see |t/HTML-tree.t| in the Whatpm package or the |
| 17 | area => 1, | ## WebHACC::Language::HTML module in the WebHACC package). |
| 18 | col => 1, | |
| 19 | input => 1, | ## ISSUE: |
| 20 | ## var doc = implementation.createDocument (null, null, null); | |
| 21 | ## doc.write (''); | |
| 22 | ## alert (doc.compatMode); | |
| 23 | ||
| 24 | require IO::Handle; | |
| 25 | ||
| 26 | ## Namespace URLs | |
| 27 | ||
| 28 | my $HTML_NS = q<http://www.w3.org/1999/xhtml>; | |
| 29 | my $MML_NS = q<http://www.w3.org/1998/Math/MathML>; | |
| 30 | my $SVG_NS = q<http://www.w3.org/2000/svg>; | |
| 31 | my $XLINK_NS = q<http://www.w3.org/1999/xlink>; | |
| 32 | my $XML_NS = q<http://www.w3.org/XML/1998/namespace>; | |
| 33 | my $XMLNS_NS = q<http://www.w3.org/2000/xmlns/>; | |
| 34 | ||
| 35 | ## Element categories | |
| 36 | ||
| 37 | ## Bits 12-15 | |
| 38 | sub SPECIAL_EL () { 0b1_000000000000000 } | |
| 39 | sub SCOPING_EL () { 0b1_00000000000000 } | |
| 40 | sub FORMATTING_EL () { 0b1_0000000000000 } | |
| 41 | sub PHRASING_EL () { 0b1_000000000000 } | |
| 42 | ||
| 43 | ## Bits 10-11 | |
| 44 | #sub FOREIGN_EL () { 0b1_00000000000 } # see Whatpm::HTML::Tokenizer | |
| 45 | sub FOREIGN_FLOW_CONTENT_EL () { 0b1_0000000000 } | |