fix category support; enable language support (#1054)

修复 #1015 引入的 bug,~~并引入新的 bug~~。
~~顺便给 #1018 做个铺垫(?~~
This commit is contained in:
sgqy
2018-11-03 10:58:41 +08:00
committed by DIYgod
parent ec80154f2f
commit 0de84a1fe2
4 changed files with 34 additions and 8 deletions
+10 -2
View File
@@ -105,11 +105,15 @@ ctx.state.data = {
title: '', // The feed title
link: '', // The feed link
description: '', // The feed description
language: '', // The language of the channel
item: [
// An article of the feed
{
title: '', // The article title
description: '', // The article content
author: '', // Author of the article
category: '', // Article category
// category: [''], // Multiple category
description: '', // The article summury or content
pubDate: '', // The article publishing datetime
guid: '', // The article unique identifier, optional, default to the article link below
link: '', // The article link
@@ -136,11 +140,15 @@ ctx.state.data = {
itunes_category: '', // Channel category
image: '', // Channel's image
description: '', // The feed description
language: '', // The language of the channel
item: [
// An item of the feed
{
title: '', // The item title
description: '', // The item content
author: '', // Author of the article
category: '', // Article category
// category: [''], // Multiple category
description: '', // The article summury or content
pubDate: '', // The item publishing datetime
guid: '', // The item unique identifier, optional, default to the item link below.
link: '', // The item link
+10 -2
View File
@@ -261,11 +261,15 @@ ctx.state.data = {
title: '', // 项目的标题
link: '', // 指向项目的链接
description: '', // 描述项目
language: '', // 频道语言
item: [
// 其中一篇文章或一项内容
{
title: '', // 文章标题
description: '', // 文章内容或描述
author: '', // 文章作者
category: '', // 文章分类
// category: [''], // 多个分类
description: '', // 文章摘要或全文
pubDate: '', // 文章发布时间
guid: '', // 文章唯一标示, 必须唯一, 可选, 默认为文章链接
link: '', // 指向文章的链接
@@ -292,11 +296,15 @@ ctx.state.data = {
itunes_category: '', // 播客分类
image: '', // 专辑图片, 作为播客源时必填
description: '', // 描述项目
language: '', // 频道语言
item: [
// 其中一篇文章或一项内容
{
title: '', // 文章标题
description: '', // 文章内容或描述
author: '', // 文章作者
category: '', // 文章分类
// category: [''], // 多个分类
description: '', // 文章摘要或全文
pubDate: '', // 文章发布时间
guid: '', // 文章唯一标示, 必须唯一, 可选, 默认为文章链接
link: '', // 指向文章的链接
+6 -2
View File
@@ -2,7 +2,7 @@
<feed xmlns="http://www.w3.org/2005/Atom">
<generator>RSSHub</generator>
<webMaster>i@diygod.me</webMaster>
<language>zh-cn</language>
<language>{{ language || 'zh-cn' }}</language>
<id>{{ id || link }}</id>
<title><![CDATA[{{@ title || 'RSSHub' }}]]></title>
@@ -58,8 +58,12 @@
<content type="html" src="{{ $e.link }}"><![CDATA[{{@ $e.description }}]]></content>
{{ /if }}
{{ if $e.category }}
{{ if typeof $e.category === 'string' }}
<category term="{{ $e.category }}"></category>
{{ else }}
{{ each $e.category $c }}
<category term="{{ $c }}"></category>
{{ /each }}
{{ /if }}
</entry>
+8 -2
View File
@@ -12,7 +12,7 @@
<webMaster>i@diygod.me</webMaster>
{{ if itunes_author }}<itunes:author>{{ itunes_author}}</itunes:author>{{ /if }}
{{ if itunes_category }}<itunes:category text="{{ itunes_category }}"/>{{ /if }}
<language>zh-cn</language>
<language>{{ language || 'zh-cn' }}</language>
{{ if image }}
<image>
<url>{{ image }}</url>
@@ -33,7 +33,13 @@
{{ if $value.enclosure_url }}<enclosure url="{{ $value.enclosure_url }}" length="{{ $value.enclosure_length }}" type="{{ $value.enclosure_type }}" />{{ /if }}
{{ if $value.itunes_duration }}<itunes:duration>{{ $value.itunes_duration }}</itunes:duration> {{ /if }}
{{ if $value.author }}<author><![CDATA[{{ $value.author }}]]></author>{{ /if }}
{{ if $value.category }}<category>{{ $value.category }}</category>{{ /if }}
{{ if typeof $value.category === 'string' }}
<category>{{ $value.category }}</category>
{{ else }}
{{ each $value.category $c }}
<category>{{ $c }}</category>
{{ /each }}
{{ /if }}
</item>
{{ /each }}
</channel>