Skip to content

Commit

Permalink
Handle markup and unicode in titles as channel names
Browse files Browse the repository at this point in the history
  • Loading branch information
rubys committed Oct 11, 2008
1 parent c846530 commit f9647ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions planet/shell/tmpl.py
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/data/filter/tmpl/planet_title_name.xml
@@ -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>
Expand Down

0 comments on commit f9647ad

Please sign in to comment.