feat: mastodon remove html tags for title

This commit is contained in:
notofoe 2020-08-08 17:12:13 +08:00
parent 7677205172
commit ffef6e1dde
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ const got = require('@/utils/got');
const parseStatuses = (data) =>
data.map((item) => {
const content = item.content ? item.content.replace(/<span.*?>|<\/span.*?>/gm, '') : '';
const contentRemovedHtml = content.replace(/<(?:.|\n)*?>/gm, '\n');
const mediaParse = (media_attachments) =>
media_attachments
@ -32,7 +33,7 @@ const parseStatuses = (data) =>
titleAuthor = `@${item.account.username}`;
media = mediaParse(item.media_attachments);
}
const titleText = item.sentitive === true ? `(CW) ${item.spoiler_text}` : content;
const titleText = item.sentitive === true ? `(CW) ${item.spoiler_text}` : contentRemovedHtml;
return {
title: `${titleAuthor}: "${titleText}"`,