Skip to content

Commit

Permalink
Remove line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Aug 19, 2019
1 parent 1a2a39f commit 9ce209a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

if (hexo.config.symbols_count_time) {

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

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

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) {
hexo.extend.filter.register('after_post_render', function(data) {
var util = require('hexo-util');
var stripHTML = util.stripHTML;
var content = data.content.replace(/<td class=\"gutter\">.*?<\/td>/g, "");
if (hexo.config.symbols_count_time.exclude_codeblock) content = content.replace(/<td class=\"code\">.*?<\/td>/g, "");
data.length = stripHTML(content).length;
var content = data.content;
if (hexo.config.symbols_count_time.exclude_codeblock) content = content.replace(/<pre>.*?<\/pre>/g, '');
data.length = stripHTML(content).replace(/\n/g, '').length;
}, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "hexo-symbols-count-time",
"description": "Symbols count and time to read for articles.",
"main": "index",
"version": "0.6.0",
"version": "0.6.1",
"engines": {
"node": ">= 0.10.0"
},
Expand Down

0 comments on commit 9ce209a

Please sign in to comment.