Skip to content

Commit 9ce209a

Browse files
Remove line breaks
1 parent 1a2a39f commit 9ce209a

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
if (hexo.config.symbols_count_time) {
44

5-
var helper = require('./lib/helper');
5+
const helper = require('./lib/helper');
6+
const stripHTML = require('hexo-util').stripHTML;
67

78
if (hexo.config.symbols_count_time.symbols) {
89
hexo.extend.helper.register('symbolsCount', helper.symbolsCount);
@@ -22,11 +23,9 @@ if (hexo.config.symbols_count_time) {
2223

2324
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) {
2425
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(/<td class=\"gutter\">.*?<\/td>/g, "");
28-
if (hexo.config.symbols_count_time.exclude_codeblock) content = content.replace(/<td class=\"code\">.*?<\/td>/g, "");
29-
data.length = stripHTML(content).length;
26+
var content = data.content;
27+
if (hexo.config.symbols_count_time.exclude_codeblock) content = content.replace(/<pre>.*?<\/pre>/g, '');
28+
data.length = stripHTML(content).replace(/\n/g, '').length;
3029
}, 0);
3130
}
3231

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "hexo-symbols-count-time",
33
"description": "Symbols count and time to read for articles.",
44
"main": "index",
5-
"version": "0.6.0",
5+
"version": "0.6.1",
66
"engines": {
77
"node": ">= 0.10.0"
88
},

0 commit comments

Comments
 (0)