Skip to content

Commit 69be59c

Browse files
committed
Revert "decode HTML entities manually."
This reverts commit 73cf61b.
1 parent 53d37da commit 69be59c

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

lib/article.js

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
"use strict";
1717

18-
var entities = require('entities'),
19-
read = require('./reader');
18+
var read = require('./reader');
2019

2120
module.exports = Article;
2221

@@ -93,23 +92,20 @@ Article.prototype.getTitle = function() {
9392
if(!title){
9493
return '';
9594
}
96-
97-
title = entities.decode(title);
98-
9995
// split title by separators.
100-
var betterTitle = '', subTitles = title.split(/[\|\-_«»]/g), betterTitleExist = function(t){
96+
var betterTitle = '', subTitles = title.split(/[\|\-_«»]/g), betterTitleExist = function(t){
10197
return (t && t.length >= 10);
10298
};
103-
10499
// when find better title, break the loop.
105100
subTitles.forEach(function(t){
106101
if(betterTitleExist(betterTitle)){
107102
return false;
103+
}else{
104+
betterTitle += ' ';
108105
}
109-
console.log(betterTitle);
110106
t = t.trim();
111107
if(t){
112-
betterTitle += ' ' + t;
108+
betterTitle += t;
113109
}
114110
});
115111

@@ -139,7 +135,6 @@ Article.prototype.contentWithTEXT = function(node, output){
139135
if(output.stripSpaces){
140136
text = text.replace(/([\s\r\t\n]+)/g, ' ');
141137
}
142-
text = entities.decode(text);
143138
return text;
144139
};
145140
/**
@@ -156,7 +151,6 @@ Article.prototype.contentWithHTML = function(node, output){
156151
if(output.stripSpaces){
157152
html = html.replace(/([\r\t\n]+)/g, ' ');
158153
}
159-
html = entities.decode(html);
160154
return html;
161155
};
162156
/**
@@ -193,7 +187,7 @@ Article.prototype.contentWithJSON = function(node, dataType){
193187
//find text.
194188
var text = self.contentWithTEXT(child, dataType);
195189
if(text){
196-
retVal.push({type: 'text', value: entities.decode(text)});
190+
retVal.push({type: 'text', value: text});
197191
}
198192
}
199193
});

0 commit comments

Comments
 (0)