parse5 1.0.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.npmignore +4 -2
- package/README.md +66 -8
- package/index.js +4 -3
- package/lib/common/foreign_content.js +255 -0
- package/lib/common/html.js +264 -0
- package/lib/{const → common}/unicode.js +0 -2
- package/lib/simple_api/simple_api_parser.js +68 -0
- package/lib/simple_api/tokenizer_proxy.js +119 -0
- package/lib/{tokenization_stage → tokenization}/named_entity_trie.js +0 -0
- package/lib/{tokenization_stage → tokenization}/preprocessor.js +2 -2
- package/lib/{tokenization_stage → tokenization}/tokenizer.js +14 -10
- package/lib/tree_adapters/default.js +1 -1
- package/lib/tree_adapters/htmlparser2.js +1 -1
- package/lib/tree_construction/doctype.js +107 -0
- package/lib/{tree_construction_stage → tree_construction}/formatting_element_list.js +0 -0
- package/lib/{tree_construction_stage → tree_construction}/open_element_stack.js +1 -1
- package/lib/{tree_construction_stage → tree_construction}/parser.js +39 -495
- package/lib/{tree_construction_stage → tree_serialization}/tree_serializer.js +3 -4
- package/package.json +42 -33
- package/lib/const/html.js +0 -154
- package/lib/tokenization_stage/parser_simulator.js +0 -2
package/package.json
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
"name": "parse5",
|
|
3
|
+
"description": "Fast full-featured HTML parsing/serialization toolset for Node. Based on WHATWG HTML5 specification. ",
|
|
4
|
+
"version": "1.1.3",
|
|
5
|
+
"author": "Ivan Nikulin <ifaaan@gmail.com> (https://github.com/inikulin)",
|
|
6
|
+
"contributors": [
|
|
7
|
+
"Sebastian Mayr <sebmaster16@gmail.com> (http://blog.smayr.name)",
|
|
8
|
+
"Sean Lang <slang800@gmail.com> (http://slang.cx)"
|
|
9
|
+
],
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"nodeunit": "0.8.0"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"html",
|
|
15
|
+
"parser",
|
|
16
|
+
"html5",
|
|
17
|
+
"WHATWG",
|
|
18
|
+
"specification",
|
|
19
|
+
"fast",
|
|
20
|
+
"html parser",
|
|
21
|
+
"html5 parser",
|
|
22
|
+
"htmlparser",
|
|
23
|
+
"parse5",
|
|
24
|
+
"serializer",
|
|
25
|
+
"html serializer",
|
|
26
|
+
"htmlserializer",
|
|
27
|
+
"sax",
|
|
28
|
+
"simple api"
|
|
29
|
+
],
|
|
30
|
+
"licenses": [
|
|
31
|
+
{
|
|
32
|
+
"type": "MIT",
|
|
33
|
+
"url": "https://raw.github.com/inikulin/parse5/master/LICENSE"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"main": "./index.js",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git://github.com/inikulin/parse5.git"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "node test/run_tests.js"
|
|
43
|
+
}
|
|
35
44
|
}
|
package/lib/const/html.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
exports.NAMESPACES = {
|
|
2
|
-
HTML: 'http://www.w3.org/1999/xhtml',
|
|
3
|
-
MATHML: 'http://www.w3.org/1998/Math/MathML',
|
|
4
|
-
SVG: 'http://www.w3.org/2000/svg',
|
|
5
|
-
XLINK: 'http://www.w3.org/1999/xlink',
|
|
6
|
-
XML: 'http://www.w3.org/XML/1998/namespace',
|
|
7
|
-
XMLNS: 'http://www.w3.org/2000/xmlns/'
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
exports.TAG_NAMES = {
|
|
11
|
-
A: 'a',
|
|
12
|
-
ADDRESS: 'address',
|
|
13
|
-
ANNOTATION_XML: 'annotation-xml',
|
|
14
|
-
APPLET: 'applet',
|
|
15
|
-
AREA: 'area',
|
|
16
|
-
ARTICLE: 'article',
|
|
17
|
-
ASIDE: 'aside',
|
|
18
|
-
|
|
19
|
-
B: 'b',
|
|
20
|
-
BASE: 'base',
|
|
21
|
-
BASEFONT: 'basefont',
|
|
22
|
-
BGSOUND: 'bgsound',
|
|
23
|
-
BIG: 'big',
|
|
24
|
-
BLOCKQUOTE: 'blockquote',
|
|
25
|
-
BODY: 'body',
|
|
26
|
-
BR: 'br',
|
|
27
|
-
BUTTON: 'button',
|
|
28
|
-
|
|
29
|
-
CAPTION: 'caption',
|
|
30
|
-
CENTER: 'center',
|
|
31
|
-
CODE: 'code',
|
|
32
|
-
COL: 'col',
|
|
33
|
-
COLGROUP: 'colgroup',
|
|
34
|
-
COMMAND: 'command',
|
|
35
|
-
|
|
36
|
-
DD: 'dd',
|
|
37
|
-
DESC: 'desc',
|
|
38
|
-
DETAILS: 'details',
|
|
39
|
-
DIALOG: 'dialog',
|
|
40
|
-
DIR: 'dir',
|
|
41
|
-
DIV: 'div',
|
|
42
|
-
DL: 'dl',
|
|
43
|
-
DT: 'dt',
|
|
44
|
-
|
|
45
|
-
EM: 'em',
|
|
46
|
-
EMBED: 'embed',
|
|
47
|
-
|
|
48
|
-
FIELDSET: 'fieldset',
|
|
49
|
-
FIGCAPTION: 'figcaption',
|
|
50
|
-
FIGURE: 'figure',
|
|
51
|
-
FONT: 'font',
|
|
52
|
-
FOOTER: 'footer',
|
|
53
|
-
FOREIGN_OBJECT: 'foreignObject',
|
|
54
|
-
FORM: 'form',
|
|
55
|
-
FRAME: 'frame',
|
|
56
|
-
FRAMESET: 'frameset',
|
|
57
|
-
|
|
58
|
-
H1: 'h1',
|
|
59
|
-
H2: 'h2',
|
|
60
|
-
H3: 'h3',
|
|
61
|
-
H4: 'h4',
|
|
62
|
-
H5: 'h5',
|
|
63
|
-
H6: 'h6',
|
|
64
|
-
HEAD: 'head',
|
|
65
|
-
HEADER: 'header',
|
|
66
|
-
HGROUP: 'hgroup',
|
|
67
|
-
HR: 'hr',
|
|
68
|
-
HTML: 'html',
|
|
69
|
-
|
|
70
|
-
I: 'i',
|
|
71
|
-
IMG: 'img',
|
|
72
|
-
IMAGE: 'image',
|
|
73
|
-
INPUT: 'input',
|
|
74
|
-
IFRAME: 'iframe',
|
|
75
|
-
ISINDEX: 'isindex',
|
|
76
|
-
|
|
77
|
-
KEYGEN: 'keygen',
|
|
78
|
-
|
|
79
|
-
LABEL: 'label',
|
|
80
|
-
LI: 'li',
|
|
81
|
-
LINK: 'link',
|
|
82
|
-
LISTING: 'listing',
|
|
83
|
-
|
|
84
|
-
MAIN: 'main',
|
|
85
|
-
MALIGNMARK: 'malignmark',
|
|
86
|
-
MARQUEE: 'marquee',
|
|
87
|
-
MATH: 'math',
|
|
88
|
-
MENU: 'menu',
|
|
89
|
-
MENUITEM: 'menuitem',
|
|
90
|
-
META: 'meta',
|
|
91
|
-
MGLYPH: 'mglyph',
|
|
92
|
-
MI: 'mi',
|
|
93
|
-
MO: 'mo',
|
|
94
|
-
MN: 'mn',
|
|
95
|
-
MS: 'ms',
|
|
96
|
-
MTEXT: 'mtext',
|
|
97
|
-
|
|
98
|
-
NAV: 'nav',
|
|
99
|
-
NOBR: 'nobr',
|
|
100
|
-
NOFRAMES: 'noframes',
|
|
101
|
-
NOEMBED: 'noembed',
|
|
102
|
-
NOSCRIPT: 'noscript',
|
|
103
|
-
|
|
104
|
-
OBJECT: 'object',
|
|
105
|
-
OL: 'ol',
|
|
106
|
-
OPTGROUP: 'optgroup',
|
|
107
|
-
OPTION: 'option',
|
|
108
|
-
|
|
109
|
-
P: 'p',
|
|
110
|
-
PARAM: 'param',
|
|
111
|
-
PLAINTEXT: 'plaintext',
|
|
112
|
-
PRE: 'pre',
|
|
113
|
-
|
|
114
|
-
RP: 'rp',
|
|
115
|
-
RT: 'rt',
|
|
116
|
-
RUBY: 'ruby',
|
|
117
|
-
|
|
118
|
-
S: 's',
|
|
119
|
-
SCRIPT: 'script',
|
|
120
|
-
SECTION: 'section',
|
|
121
|
-
SELECT: 'select',
|
|
122
|
-
SOURCE: 'source',
|
|
123
|
-
SMALL: 'small',
|
|
124
|
-
SPAN: 'span',
|
|
125
|
-
STRIKE: 'strike',
|
|
126
|
-
STRONG: 'strong',
|
|
127
|
-
STYLE: 'style',
|
|
128
|
-
SUB: 'sub',
|
|
129
|
-
SUMMARY: 'summary',
|
|
130
|
-
SUP: 'sup',
|
|
131
|
-
|
|
132
|
-
TABLE: 'table',
|
|
133
|
-
TBODY: 'tbody',
|
|
134
|
-
TEXTAREA: 'textarea',
|
|
135
|
-
TFOOT: 'tfoot',
|
|
136
|
-
TD: 'td',
|
|
137
|
-
TH: 'th',
|
|
138
|
-
THEAD: 'thead',
|
|
139
|
-
TITLE: 'title',
|
|
140
|
-
TR: 'tr',
|
|
141
|
-
TRACK: 'track',
|
|
142
|
-
TT: 'tt',
|
|
143
|
-
|
|
144
|
-
U: 'u',
|
|
145
|
-
UL: 'ul',
|
|
146
|
-
|
|
147
|
-
SVG: 'svg',
|
|
148
|
-
|
|
149
|
-
VAR: 'var',
|
|
150
|
-
|
|
151
|
-
WBR: 'wbr',
|
|
152
|
-
|
|
153
|
-
XMP: 'xmp'
|
|
154
|
-
};
|