Default channel_name to source title
This commit is contained in:
parent
f3e57e261a
commit
c619402e6e
@ -167,6 +167,8 @@ def tmpl_mapper(source, rules):
|
||||
for name,value in source.source.items():
|
||||
if name.startswith('planet_'):
|
||||
output['channel_' + name[7:]] = String(value)
|
||||
if not output.get('channel_name'):
|
||||
output['channel_name'] = source.source.get('title', '')
|
||||
|
||||
return output
|
||||
|
||||
|
13
tests/data/filter/tmpl/planet_title_name.xml
Normal file
13
tests/data/filter/tmpl/planet_title_name.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<!--
|
||||
Description: id
|
||||
Expect: Items[0]['channel_name'] == 'blog title'
|
||||
-->
|
||||
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<entry>
|
||||
<source>
|
||||
<title>blog title</title>
|
||||
</source>
|
||||
</entry>
|
||||
</feed>
|
||||
|
Loading…
x
Reference in New Issue
Block a user