mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -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');
|
tagNames = _.pluck(this.tags, 'name');
|
||||||
|
|
||||||
if (tagNames.length) {
|
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
|
// ### Content Helper
|
||||||
|
|
|
@ -640,6 +640,18 @@ describe('Core Helpers', function () {
|
||||||
String(rendered).should.equal('on haunted, ghost forever');
|
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 () {
|
it('does not add prefix or suffix if no tags exist', function () {
|
||||||
var rendered = handlebars.helpers.tags.call(
|
var rendered = handlebars.helpers.tags.call(
|
||||||
{},
|
{},
|
||||||
|
|
Loading…
Add table
Reference in a new issue