fix(route): fix nytimes paragraph (#13146)

This commit is contained in:
JimenezLi
2023-08-29 00:25:08 +08:00
committed by GitHub
parent afcf977426
commit 8fbd184e5b
2 changed files with 6 additions and 4 deletions
+1 -4
View File
@@ -81,10 +81,7 @@ module.exports = async (ctx) => {
// Match 感谢|謝.*?cn.letters@nytimes.com。
const ending = /感(&#x8C22|&#x8B1D);.*?cn\.letters@nytimes\.com。/g;
const matching = '<div class="article-paragraph">';
const formatted = '<br>' + matching;
single.description = result.description.replace(ending, '').split(matching).join(formatted);
single.description = result.description?.replace(ending, '');
if (hasEnVersion) {
single.title = result.title;
+5
View File
@@ -79,6 +79,11 @@ const ProcessFeed = (data, hasEnVersion = false) => {
$(e).remove();
});
// divide paragraphs with <p>
content.find('div.article-paragraph').each((i, e) => {
$(e).html(`<p>${$(e).html()}</p>`);
});
if ($('figure.article-span-photo').length > 0) {
// there is a cover photo
const cover = $('figure.article-span-photo');