From b0216ca3de82202095f1a4fce479c0aed745eb9f Mon Sep 17 00:00:00 2001 From: Ethan Shen <42264778+nczitzk@users.noreply.github.com> Date: Wed, 28 Sep 2022 08:09:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E5=8D=8E=E5=B0=94=E8=A1=97?= =?UTF-8?q?=E8=A7=81=E9=97=BB=E5=AE=9E=E6=97=B6=E5=BF=AB=E8=AE=AF=E5=9B=BE?= =?UTF-8?q?=E7=89=87=20(#10925)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/v2/wallstreetcn/live.js | 8 +++++++- lib/v2/wallstreetcn/templates/description.art | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/v2/wallstreetcn/templates/description.art diff --git a/lib/v2/wallstreetcn/live.js b/lib/v2/wallstreetcn/live.js index 7e584ddd164e3..ee32c0c7a6651 100644 --- a/lib/v2/wallstreetcn/live.js +++ b/lib/v2/wallstreetcn/live.js @@ -1,5 +1,7 @@ const got = require('@/utils/got'); const { parseDate } = require('@/utils/parse-date'); +const { art } = require('@/utils/render'); +const path = require('path'); const titles = { global: '要闻', @@ -30,9 +32,13 @@ module.exports = async (ctx) => { .map((item) => ({ link: item.uri, title: item.title || item.content_text, - description: item.content + (item.content_more ?? ''), pubDate: parseDate(item.display_time * 1000), author: item.author?.display_name ?? '', + description: art(path.join(__dirname, 'templates/description.art'), { + description: item.content, + more: item.content_more, + images: item.images, + }), })); ctx.state.data = { diff --git a/lib/v2/wallstreetcn/templates/description.art b/lib/v2/wallstreetcn/templates/description.art new file mode 100644 index 0000000000000..ee1f9e6f22831 --- /dev/null +++ b/lib/v2/wallstreetcn/templates/description.art @@ -0,0 +1,11 @@ +{{ if description }} +{{@ description }} +{{ /if }} +{{ if more }} +{{@ more }} +{{ /if }} +{{ if images }} +{{ each images image }} + +{{ /each }} +{{ /if }} \ No newline at end of file