mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
5ea14118c8
No issue. - Ember@1.10.0 - Update grunt-ember-templates to version that supports HTMLBars. - Update Gruntfile.js to compile templates with HTMLBars. - Convert Handlebars code to its HTMLBars equivalent.
23 lines
433 B
JavaScript
23 lines
433 B
JavaScript
import counter from 'ghost/utils/word-count';
|
|
|
|
var countWords = Ember.HTMLBars.makeBoundHelper(function (arr /* hashParams */) {
|
|
if (!arr || !arr.length) {
|
|
return;
|
|
}
|
|
|
|
var markdown,
|
|
count;
|
|
|
|
markdown = arr[0] || '';
|
|
|
|
if (/^\s*$/.test(markdown)) {
|
|
return '0 words';
|
|
}
|
|
|
|
count = counter(markdown);
|
|
|
|
return count + (count === 1 ? ' word' : ' words');
|
|
});
|
|
|
|
export default countWords;
|