diff --git a/docs/en/program-update.md b/docs/en/program-update.md index 39e57282d..cbeace9b6 100644 --- a/docs/en/program-update.md +++ b/docs/en/program-update.md @@ -238,6 +238,12 @@ Language +## fish shell + +### Release Notes + + + ## FossHub ### Software Update diff --git a/docs/program-update.md b/docs/program-update.md index 138373a75..e8410ce62 100644 --- a/docs/program-update.md +++ b/docs/program-update.md @@ -270,6 +270,12 @@ pageClass: routes +## fish shell + +### Release Notes + + + ## FossHub ### Software Update diff --git a/lib/v2/fishshell/index.js b/lib/v2/fishshell/index.js new file mode 100644 index 000000000..7f0b90c91 --- /dev/null +++ b/lib/v2/fishshell/index.js @@ -0,0 +1,27 @@ +const cheerio = require('cheerio'); +const got = require('@/utils/got'); +const config = require('@/config').value; +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const link = 'https://fishshell.com/docs/current/relnotes.html'; + const data = await ctx.cache.tryGet(link, async () => (await got(link)).data, config.cache.contentExpire, false); + const $ = cheerio.load(data); + ctx.state.data = { + link, + title: 'Release notes — fish-shell', + language: 'en', + item: $('#release-notes > section') + .map((_, item) => { + const title = $(item).find('h2').contents().first().text(); + const date = title.match(/\(released (.+?)\)/)?.[1]; + return { + title, + link: new URL($(item).find('a').attr('href'), link).href, + pubDate: date ? parseDate(date, 'MMMM D, YYYY') : undefined, + description: $(item).html(), + }; + }) + .get(), + }; +}; diff --git a/lib/v2/fishshell/maintainer.js b/lib/v2/fishshell/maintainer.js new file mode 100644 index 000000000..e2b88a54c --- /dev/null +++ b/lib/v2/fishshell/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/': ['x2cf'], +}; diff --git a/lib/v2/fishshell/radar.js b/lib/v2/fishshell/radar.js new file mode 100644 index 000000000..158b09fa4 --- /dev/null +++ b/lib/v2/fishshell/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'fishshell.com': { + _name: 'fish shell', + '.': [ + { + title: 'Release Notes', + docs: 'https://docs.rsshub.app/program-update.html#fish-shell', + source: ['/'], + target: '/fishshell', + }, + ], + }, +}; diff --git a/lib/v2/fishshell/router.js b/lib/v2/fishshell/router.js new file mode 100644 index 000000000..20c52b09d --- /dev/null +++ b/lib/v2/fishshell/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/', require('./index')); +};