Skip to content

Commit

Permalink
fix(route): 华尔街见闻实时快讯图片 (DIYgod#10925)
Browse files Browse the repository at this point in the history
  • Loading branch information
nczitzk authored Sep 28, 2022
1 parent a1faf40 commit b0216ca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/v2/wallstreetcn/live.js
Original file line number Diff line number Diff line change
@@ -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: '要闻',
Expand Down Expand Up @@ -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 = {
Expand Down
11 changes: 11 additions & 0 deletions lib/v2/wallstreetcn/templates/description.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ if description }}
{{@ description }}
{{ /if }}
{{ if more }}
{{@ more }}
{{ /if }}
{{ if images }}
{{ each images image }}
<img src="{{ image.uri }}" width="{{ image.width }}" height="{{ image.height }}">
{{ /each }}
{{ /if }}

0 comments on commit b0216ca

Please sign in to comment.