1 | 'use strict';
|
2 |
|
3 | var Parser = require('./parser'),
|
4 | Serializer = require('./serializer');
|
5 |
|
6 |
|
7 |
|
8 | exports.parse = function parse(html, options) {
|
9 | var parser = new Parser(options);
|
10 |
|
11 | return parser.parse(html);
|
12 | };
|
13 |
|
14 | exports.parseFragment = function parseFragment(fragmentContext, html, options) {
|
15 | if (typeof fragmentContext === 'string') {
|
16 | options = html;
|
17 | html = fragmentContext;
|
18 | fragmentContext = null;
|
19 | }
|
20 |
|
21 | var parser = new Parser(options);
|
22 |
|
23 | return parser.parseFragment(html, fragmentContext);
|
24 | };
|
25 |
|
26 | exports.serialize = function (node, options) {
|
27 | var serializer = new Serializer(node, options);
|
28 |
|
29 | return serializer.serialize();
|
30 | };
|
31 |
|
32 |
|
33 |
|
34 | exports.treeAdapters = {
|
35 | default: require('./tree_adapters/default'),
|
36 | htmlparser2: require('./tree_adapters/htmlparser2')
|
37 | };
|
38 |
|
39 |
|
40 |
|
41 | exports.ParserStream = require('./parser/parser_stream');
|
42 | exports.PlainTextConversionStream = require('./parser/plain_text_conversion_stream');
|
43 | exports.SerializerStream = require('./serializer/serializer_stream');
|
44 | exports.SAXParser = require('./sax');
|