* Parse html to cheerio dom. * @param o options * @param e extra data * @return {String}
(o, e)
| 93 | * @return {String} |
| 94 | */ |
| 95 | function parse(o, e){ |
| 96 | if (!o.html) { |
| 97 | return ''; |
| 98 | } |
| 99 | if (o.options.killBreaks) { |
| 100 | // replace <br />(blanks goes here) to <br />. |
| 101 | o.html = o.html.replace(/<br[^\/>]*\/?>/ig, '<br />'); |
| 102 | // remove tab symbols like \r\t\n |
| 103 | o.html = o.html.replace(/[\n\r\t]{2,}/gi, ' '); |
| 104 | } |
| 105 | |
| 106 | var co = {decodeEntities: false}; |
| 107 | ['normalizeWhitespace', 'xmlMode', 'lowerCaseTags'].forEach(function(n){ |
| 108 | co[n] = !!o.options[n]; |
| 109 | }); |
| 110 | |
| 111 | var $ = cheerio.load(o.html, co); |
| 112 | o.callback(null, new Article($, o.options), o.options, e); |
| 113 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…