diff --git a/filters.js b/filters.js index 1f5e9f373..37ae413ad 100644 --- a/filters.js +++ b/filters.js @@ -66,7 +66,7 @@ var filters = { 'sort': (v, arg) => v.sort(arg), 'split': (v, arg) => stringify(v).split(arg), 'strip': (v) => stringify(v).trim(), - 'strip_html': v => stringify(v).replace(/<\/?\s*\w+\s*\/?>/g, ''), + 'strip_html': v => stringify(v).replace(/|||<.*?>/g, ''), 'strip_newlines': v => stringify(v).replace(/\n/g, ''), 'times': (v, arg) => v * arg, 'truncate': (v, l, o) => { diff --git a/test/filters.js b/test/filters.js index c432423bb..51d34a5bc 100644 --- a/test/filters.js +++ b/test/filters.js @@ -301,9 +301,21 @@ describe('filters', function () { describe('strip_html', function () { it('should strip all tags', function () { - return test('{{ "Have you read Ulysses?" | strip_html }}', + return test('{{ "Have you read Ulysses?" | strip_html }}', 'Have you read Ulysses?') }) + it('should strip all comment tags', function () { + return test('{{ "Ulysses?" | strip_html }}', + 'Ulysses?') + }) + it('should strip all style tags and their contents', function () { + return test('{{ "Ulysses?" | strip_html }}', + 'Ulysses?') + }) + it('should strip all scripts tags and their contents', function () { + return test('{{ "Ulysses?" | strip_html }}', + 'Ulysses?') + }) it('should strip until empty', function () { return test('{{"

< p >

" | strip_html }}', '') })