From 789418f987cd3d98e35bc2c08da178443c0e8b43 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 26 Mar 2015 17:27:50 -0400 Subject: [PATCH] stripTags and escape template helpers use it like so {function.stripTags, title} see vanilla or persona topics_list.tpl for more info --- public/src/modules/helpers.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js index dfecb7e78b..4aaef00a61 100644 --- a/public/src/modules/helpers.js +++ b/public/src/modules/helpers.js @@ -1,6 +1,6 @@ ;(function(exports) { "use strict"; - /* globals define */ + /* globals define, utils */ // export the class if we are in a Node-like system. if (typeof module === 'object' && module.exports === exports) { @@ -9,6 +9,9 @@ var helpers = {}; + var utils = utils || require('../utils'), + S = S || require('string'); + helpers.displayMenuItem = function(data, index) { var item = data.navigation[index], properties = item.properties; @@ -43,6 +46,14 @@ return JSON.stringify(obj).replace(/&/gm,"&").replace(//gm,">").replace(/"/g, '"'); }; + helpers.escape = function(str) { + return utils.escapeHTML(str); + }; + + helpers.stripTags = function(str) { + return S(str).stripTags().s; + } + helpers.generateCategoryBackground = function(category) { var style = [];