From 592012d9e8929f66db6e7b82f6c3cafde9fc3ffd Mon Sep 17 00:00:00 2001 From: Ondrej Brinkel Date: Tue, 12 Aug 2014 14:38:17 +0200 Subject: [PATCH] added template.escape() --- lib/template.js | 14 +++++++++++++- package.json | 7 +++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/template.js b/lib/template.js index 2ddbdf5..401f170 100644 --- a/lib/template.js +++ b/lib/template.js @@ -1,5 +1,6 @@ var fs = require('fs'); var path = require('path') + , utils = require('utilities') , geddyPath = path.normalize(path.join(require.resolve('geddy'), '../../')); var engineToExt = { @@ -249,4 +250,15 @@ function escaped(content, engine) return ''; } } -module.exports.escaped = escaped; \ No newline at end of file +module.exports.escaped = escaped; + +/** + * Escapes a string + * @param str {String} + * @return {String} + */ +function escape(str) +{ + return utils.string.escapeXML(str.replace(/;\S*/, '')); +} +module.exports.escape = escape; \ No newline at end of file diff --git a/package.json b/package.json index f5f9326..035f565 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "geddy-genutils", - "version": "0.0.9", + "version": "0.0.10", "description": "General purpose utilities for geddy generators.", "main": "index.js", "scripts": { @@ -18,5 +18,8 @@ "bugs": { "url": "https://github.com/geddy/geddy-genutils/issues" }, - "homepage": "https://github.com/geddy/geddy-genutils" + "homepage": "https://github.com/geddy/geddy-genutils", + "dependencies": { + "utilities": "*" + } }