mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Merge pull request #2151 from halfdan/2123-tags-suffix
Allow HTML inside tag prefix/suffix
This commit is contained in:
commit
85e997bd2e
2 changed files with 15 additions and 3 deletions
|
@ -181,10 +181,10 @@ coreHelpers.tags = function (options) {
|
|||
tagNames = _.pluck(this.tags, 'name');
|
||||
|
||||
if (tagNames.length) {
|
||||
output = prefix + tagNames.join(separator) + suffix;
|
||||
output = prefix + _.escape(tagNames.join(separator)) + suffix;
|
||||
}
|
||||
|
||||
return output;
|
||||
return new hbs.handlebars.SafeString(output);
|
||||
};
|
||||
|
||||
// ### Content Helper
|
||||
|
|
|
@ -640,6 +640,18 @@ describe('Core Helpers', function () {
|
|||
String(rendered).should.equal('on haunted, ghost forever');
|
||||
});
|
||||
|
||||
it('can add a prefix and suffix with HTML', function () {
|
||||
var tags = [{name: 'haunted'}, {name: 'ghost'}],
|
||||
rendered = handlebars.helpers.tags.call(
|
||||
{tags: tags},
|
||||
{"hash": {suffix: ' •', prefix: '… '}}
|
||||
);
|
||||
|
||||
should.exist(rendered);
|
||||
|
||||
String(rendered).should.equal('… haunted, ghost •');
|
||||
});
|
||||
|
||||
it('does not add prefix or suffix if no tags exist', function () {
|
||||
var rendered = handlebars.helpers.tags.call(
|
||||
{},
|
||||
|
@ -1032,4 +1044,4 @@ describe('Core Helpers', function () {
|
|||
}).then(null, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue