fix: remove multiple <br> (#1624)

close #1620
This commit is contained in:
Henry Wang
2019-02-27 10:54:29 +08:00
committed by DIYgod
parent c4ed704607
commit 12cb9b0e3d
+4 -6
View File
@@ -25,17 +25,15 @@ module.exports = async (ctx) => {
wb = {};
item = $(ele);
titleEle = item.find('.wgtCell_txt');
wb.title = titleEle
.text()
.replace(/^\s+|\s+$/g, '')
.replace(/\u200B/g, '');
wb.title = titleEle.text().trim();
if (wb.title === '') {
wb.title = '[图片]';
}
wb.description = titleEle
.html()
.replace(/^\s+|\s+$/g, '')
.replace(/(\r\n|\r|\n)/g, '<br>')
.trim()
.replace(/(\r\n|\r|\n)+/g, '<br>')
.replace(/(( ?)+<br>( ?)+){2,}/g, '')
.replace(/thumbnail/, 'large');
wb.pubDate = date(item.find('.link_d').html(), 8);
wb.link = item.find('.wgtCell_tm a').attr('href');