File tree 1 file changed +3
-5
lines changed
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -10,11 +10,9 @@ const getWordCount = (post) => {
10
10
const content = stripHTML ( post . origin || post . content ) . replace ( / \r ? \n | \r / g, '' ) . replace ( / \s + / g, '' ) ;
11
11
12
12
if ( ! post . wordcount ) {
13
- if ( [ 'zh-cn' , 'zh-hk' , 'zh-tw' ] . includes ( lang ) ) {
14
- post . wordcount = ( content . match ( / [ \u4E00 - \u9FA5 ] / g) || [ ] ) . length ;
15
- } else {
16
- post . wordcount = ( content . replace ( / [ \u4E00 - \u9FA5 ] / g, '' ) . match ( / [ a - z A - Z 0 - 9 _ \u0392 - \u03c9 \u0400 - \u04FF ] + | [ \u4E00 - \u9FFF \u3400 - \u4dbf \uf900 - \ufaff \u3040 - \u309f \uac00 - \ud7af \u0400 - \u04FF ] + | [ \u00E4 \u00C4 \u00E5 \u00C5 \u00F6 \u00D6 ] + | \w + / g) || [ ] ) . length ;
17
- }
13
+ const zhCount = ( content . match ( / [ \u4E00 - \u9FA5 ] / g) || [ ] ) . length ;
14
+ const enCount = ( content . replace ( / [ \u4E00 - \u9FA5 ] / g, '' ) . match ( / [ a - z A - Z 0 - 9 _ \u0392 - \u03c9 \u0400 - \u04FF ] + | [ \u4E00 - \u9FFF \u3400 - \u4dbf \uf900 - \ufaff \u3040 - \u309f \uac00 - \ud7af \u0400 - \u04FF ] + | [ \u00E4 \u00C4 \u00E5 \u00C5 \u00F6 \u00D6 ] + | \w + / g) || [ ] ) . length ;
15
+ post . wordcount = zhCount + enCount
18
16
}
19
17
return post . wordcount ;
20
18
} ;
You can’t perform that action at this time.
0 commit comments