diff options
Diffstat (limited to '')
-rw-r--r-- | lib/feed2imap/channel.rb | 14 | ||||
-rw-r--r-- | lib/feed2imap/rexml_patch.rb | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/feed2imap/channel.rb b/lib/feed2imap/channel.rb index 839d483..3fcc3e8 100644 --- a/lib/feed2imap/channel.rb +++ b/lib/feed2imap/channel.rb @@ -146,10 +146,16 @@ class Item # Content if (e = item.elements['content:encoded']) || (e = item.elements['description'] || item.elements['rss:description']) - if e.cdatas[0] - @content = e.cdatas[0].to_s.toUTF8(@channel.encoding).rmWhiteSpace! - elsif e.text - @content = e.text.toUTF8(@channel.encoding).text2html + if e.children.length > 1 + s = '' + e.children.each { |c| s += c.to_s } + @content = s.toUTF8(@channel.encoding).rmWhiteSpace! + elsif e.children.length == 1 + if e.cdatas[0] + @content = e.cdatas[0].to_s.toUTF8(@channel.encoding).rmWhiteSpace! + elsif e.text + @content = e.text.toUTF8(@channel.encoding).text2html + end end end # Date diff --git a/lib/feed2imap/rexml_patch.rb b/lib/feed2imap/rexml_patch.rb index 3d919ae..bce0be3 100644 --- a/lib/feed2imap/rexml_patch.rb +++ b/lib/feed2imap/rexml_patch.rb @@ -38,4 +38,10 @@ module REXML @encoding = enc || 'utf-8' end end + + class Element + def children + @children + end + end end |