Handle markup and unicode in titles as channel names

This commit is contained in:
Sam Ruby 2008-10-11 11:21:25 -04:00
parent c8465307e3
commit f9647ad36a
2 changed files with 5 additions and 4 deletions

View File

@ -167,8 +167,9 @@ 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', '')
if not output.get('channel_name') and \
source.source.has_key('title_detail'):
output['channel_name'] = Plain(source.source.title_detail.value)
return output

View File

@ -1,12 +1,12 @@
<!--
Description: id
Expect: Items[0]['channel_name'] == 'blog title'
Expect: Items[0]['channel_name'] == 'Se\xc3\xb1or Frog'
-->
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<source>
<title>blog title</title>
<title type="html">Se&ntilde;or Frog</title>
</source>
</entry>
</feed>