Ghost/core/server/helpers/encode.js
Hannah Wolfe 10fc320cc8 Rename confusing 'context' variables
no issue
- In Ghost, 'context' means the page or section of a blog we're currently within
when rendering a theme, e.g. 'post' or 'tag' or 'home'.
- In handlebars 'context' refers to the blob of JSON that is tied to a template.
- These two uses of the word 'context' have gotten very confusing, so I've removed all usage of 'context' within the Ghost handlebars helpers, EXCEPT where they actually refer to the current context (e.g. the is helper)
2016-02-21 22:07:15 +00:00

16 lines
298 B
JavaScript

// # Encode Helper
//
// Usage: `{{encode uri}}`
//
// Returns URI encoded string
var hbs = require('express-hbs'),
encode;
encode = function (string, options) {
var uri = string || options;
return new hbs.handlebars.SafeString(encodeURIComponent(uri));
};
module.exports = encode;