File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
if ( hexo . config . symbols_count_time ) {
4
4
5
- var helper = require ( './lib/helper' ) ;
5
+ const helper = require ( './lib/helper' ) ;
6
+ const stripHTML = require ( 'hexo-util' ) . stripHTML ;
6
7
7
8
if ( hexo . config . symbols_count_time . symbols ) {
8
9
hexo . extend . helper . register ( 'symbolsCount' , helper . symbolsCount ) ;
@@ -22,11 +23,9 @@ if (hexo.config.symbols_count_time) {
22
23
23
24
if ( hexo . config . symbols_count_time . symbols || hexo . config . symbols_count_time . time || hexo . config . symbols_count_time . total_symbols || hexo . config . symbols_count_time . total_time ) {
24
25
hexo . extend . filter . register ( 'after_post_render' , function ( data ) {
25
- var util = require ( 'hexo-util' ) ;
26
- var stripHTML = util . stripHTML ;
27
- var content = data . content . replace ( / < t d c l a s s = \" g u t t e r \" > .* ?< \/ t d > / g, "" ) ;
28
- if ( hexo . config . symbols_count_time . exclude_codeblock ) content = content . replace ( / < t d c l a s s = \" c o d e \" > .* ?< \/ t d > / g, "" ) ;
29
- data . length = stripHTML ( content ) . length ;
26
+ var content = data . content ;
27
+ if ( hexo . config . symbols_count_time . exclude_codeblock ) content = content . replace ( / < p r e > .* ?< \/ p r e > / g, '' ) ;
28
+ data . length = stripHTML ( content ) . replace ( / \n / g, '' ) . length ;
30
29
} , 0 ) ;
31
30
}
32
31
Original file line number Diff line number Diff line change 2
2
"name" : " hexo-symbols-count-time" ,
3
3
"description" : " Symbols count and time to read for articles." ,
4
4
"main" : " index" ,
5
- "version" : " 0.6.0 " ,
5
+ "version" : " 0.6.1 " ,
6
6
"engines" : {
7
7
"node" : " >= 0.10.0"
8
8
},
You can’t perform that action at this time.
0 commit comments