Skip to content

Commit

Permalink
Fixed: #131
Browse files Browse the repository at this point in the history
  • Loading branch information
Di committed Jul 18, 2017
1 parent 9e2d0d9 commit 956eb4b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wxParse/html2json.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,19 @@ function removeDOCTYPE(html) {
.replace(/<.*!DOCTYPE.*\>\n/, '');
}

function trimHtml(html) {
return html
.replace(/\n+/g, '')
.replace(/<!--.*?-->/ig, '')
.replace(/\/\*.*?\*\//ig, '')
.replace(/[ ]+</ig, '<')
}


function html2json(html, bindName) {
//处理字符串
html = removeDOCTYPE(html);
html = trimHtml(html);
html = wxDiscode.strDiscode(html);
//生成node节点
var bufArray = [];
Expand Down

0 comments on commit 956eb4b

Please sign in to comment.