mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-27 21:03:29 +03:00
Fix word count in ember.
This commit is contained in:
parent
3fc9075383
commit
8b3e2c636f
@ -1,6 +1,7 @@
|
|||||||
export default function (s) {
|
export default function (s) {
|
||||||
s = s.replace(/(^\s*)|(\s*$)/gi, ''); // exclude start and end white-space
|
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(/[ ]{2,}/gi, ' '); // 2 or more space to 1
|
||||||
s = s.replace(/\n /, '\n'); // exclude newline with a start spacing
|
s = s.replace(/\n /gi, '\n'); // exclude newline with a start spacing
|
||||||
return s.split(' ').length;
|
s = s.replace(/\n+/gi, '\n');
|
||||||
|
return s.split(/ |\n/).length;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user