Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html标签前后有空格的情况下,图片分辨率的nodes索引有误 #131

Closed
mzdbxqh opened this issue Jul 9, 2017 · 1 comment · Fixed by #157
Closed

html标签前后有空格的情况下,图片分辨率的nodes索引有误 #131

mzdbxqh opened this issue Jul 9, 2017 · 1 comment · Fixed by #157

Comments

@mzdbxqh
Copy link

mzdbxqh commented Jul 9, 2017

如题,如果

前面有空格什么的,图片分辨率就存错node了。
我的处理方法是在html2json.js里边把空格什么的去掉了。
pr就不提了,debug了一晚,心累

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);
...
}
@icindy
Copy link
Owner

icindy commented Jul 10, 2017

谢谢反馈 我看下加入

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants