From fa8cdce748d82f6d984895b6f742d79f0180db6c Mon Sep 17 00:00:00 2001 From: barisusakli Date: Sun, 27 Apr 2014 17:17:07 -0400 Subject: [PATCH] closes #1448 --- public/src/utils.js | 11 +---------- src/posts.js | 3 ++- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/public/src/utils.js b/public/src/utils.js index 9e733f8234..528f5b9981 100644 --- a/public/src/utils.js +++ b/public/src/utils.js @@ -244,16 +244,7 @@ tags : ['a', 'abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'b', 'base', 'basefont', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'], - getTagsExcept: function(excludeTags) { - var tagsToReturn = utils.tags.slice(); - excludeTags.forEach(function(tag) { - var index = tagsToReturn.indexOf(tag); - if(index !== -1) { - tagsToReturn.splice(index, 1); - } - }); - return tagsToReturn; - }, + stripTags : ['abbr', 'acronym', 'address', 'applet', 'area', 'article', 'aside', 'audio', 'base', 'basefont', 'bdi', 'bdo', 'big', 'body', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hr', 'html', 'iframe', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meta', 'meter', 'nav', 'noframes', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'param', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'source', 'span', 'strike', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'], escapeRegexChars: function(text) { return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); diff --git a/src/posts.js b/src/posts.js index 2cb46d2013..e6d97ba7af 100644 --- a/src/posts.js +++ b/src/posts.js @@ -323,11 +323,12 @@ var db = require('./database'), if (stripTags) { var s = S(results.content); - post.content = s.stripTags.apply(s, utils.getTagsExcept(['img', 'i', 'p'])).s; + post.content = s.stripTags.apply(s, utils.stripTags).s; } else { post.content = results.content; } + callback(null, post); }); }