Skip to content

Commit

Permalink
chore: update issue template scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 15, 2024
1 parent 9f70467 commit b699589
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/scripts/create-rss.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const rssFilePath = `./feeds/rss/${year}-${week}.json`;
url: issueLink.replace(/(^[\n\s]+)|([\n\s]+$)/, ''),
title: issueTitle.replace(/^\[(.+?)\]\s+/g, ''),
content_html: issueBody,
summary: issueBody,
summary: issueBody.replace(/(^[\n\s]+)|([\n\s]+$)/, ''),
banner_image: bannerImage,
date_published: issueDate,
author: {
Expand Down Expand Up @@ -138,9 +138,15 @@ const rssFilePath = `./feeds/rss/${year}-${week}.json`;
let mdListContent = "";
uniqueArray.forEach(post => {
let rssurl = post.url.replace(/(^[\n\s\r]+)|([\n\s\r]+$)/, '')
let rsstitle = post.title.replace(/(^[\n\s\r]+)|([\n\s\r]+$)/, '')
mdListContent += `- [${rsstitle}](${rssurl}) [#${post.id}](https://github.com/jaywcjlove/quick-rss/issues/${post.id}) [@${post.author.name}](https://github.com/${post.author.name})\n`;
const rssurl = post.url.replace(/(^[\n\s\r]+)|([\n\s\r]+$)/, '')
const rsstitle = post.title.replace(/(^[\n\s\r]+)|([\n\s\r]+$)/, '')
const description = issueBody
.replace(/!\[.*?\]\(.*?\)/g, '') // 去掉图片链接
.replace(/<\/?[^>]+(>|$)/g, '') // 去掉 HTML 标签
.replace(/\s+/g, ' ') // 去掉多余的换行符或空格
.trim(); // 去掉前后的空格
const descriptionImage = post.image ? `![](post.image)` : ""
mdListContent += `\n### [${rsstitle}](${rssurl}) [#${post.id}](https://github.com/jaywcjlove/quick-rss/issues/${post.id}) [@${post.author.name}](https://github.com/${post.author.name})\n\n${descriptionImage}\n\n${description}\n`;
feed.addItem({
title: rsstitle,
id: post.id,
Expand Down

0 comments on commit b699589

Please sign in to comment.