mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Merge pull request #3033 from halfdan/fix-word-count
Fix word count in ember.
This commit is contained in:
commit
79c2132905
@ -1,6 +1,7 @@
|
||||
export default function (s) {
|
||||
s = s.replace(/(^\s*)|(\s*$)/gi, ''); // exclude start and end white-space
|
||||
s = s.replace(/[ ]{2,}/gi, ' '); // 2 or more space to 1
|
||||
s = s.replace(/\n /, '\n'); // exclude newline with a start spacing
|
||||
return s.split(' ').length;
|
||||
s = s.replace(/\n /gi, '\n'); // exclude newline with a start spacing
|
||||
s = s.replace(/\n+/gi, '\n');
|
||||
return s.split(/ |\n/).length;
|
||||
}
|
Loading…
Reference in New Issue
Block a user