mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
stripTags and escape template helpers
use it like so {function.stripTags, title}
see vanilla or persona topics_list.tpl for more info
This commit is contained in:
@@ -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(/>/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 = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user