diff --git a/data/version b/data/version index 1fbea89c..b85f220a 100644 --- a/data/version +++ b/data/version @@ -1,5 +1 @@ -<<<<<<< HEAD -{"version":"0.8","updatedTime":"2015-10-24T07:11:51.505Z"} -======= -{"version":"0.9","updatedTime":"2015-10-16T07:11:51.505Z"} ->>>>>>> feature-export-from-evernote +{"version":"0.9","updatedTime":"2015-10-26T07:11:51.505Z"} \ No newline at end of file diff --git a/node_modules/resanitize/resanitize.js b/node_modules/resanitize/resanitize.js index e1ddad5f..694b4f48 100644 --- a/node_modules/resanitize/resanitize.js +++ b/node_modules/resanitize/resanitize.js @@ -196,30 +196,64 @@ function stripUnsafeAttrs (str) { module.exports.stripUnsafeAttrs = stripUnsafeAttrs; function stripUnsafeTags (str) { - var el = /<(?:wbr|form|input|font|blink|script|style|comment|plaintext|xmp|link|listing|meta|body|frame|frameset)\b/; + + // var el = /<(?:wbr|form|input|font|blink|script|style|comment|plaintext|xmp|link|listing|meta|body|frame|frameset)\b/; var ct = 0, max = 2; + // Prohibited elements + var otherTags = ['wbr','style', 'comment', 'plaintext', 'xmp', 'listing', + // 以下是evernote禁止的 + 'applet','base','basefont','bgsound','blink','body','button','dir','embed','fieldset','frameset','head', + 'html','iframe','ilayer','input','isindex','label','layer','legend','link','marquee','menu','meta','noframes', + 'noscript','object','optgroup','option','param','plaintext','script','select','style','textarea','xml']; + + var patterReplace1 = ''; + var patterReplace2 = ''; + + var pattern = '<(?:'; + for (var i = 0; i < otherTags.length; ++i) { + pattern += otherTags[i] + '|'; + patterReplace2 += otherTags[i] + '|'; + } + pattern += 'body)\\b'; + patterReplace2 += 'body' + + var reg = new RegExp(pattern); + + // 单个自闭合 + var replageReg = new RegExp('<\\/?(?:' + patterReplace2 + ')[^>]*?>', 'gi'); + // We'll repeatedly try to strip any maliciously nested elements up to [max] times - while (el.test(str) && ct++ < max) { - str = str.replace(/