From 92af4bd77214227bc3b8c2826763754cd3068821 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Tue, 3 Jul 2012 17:33:23 +0100 Subject: [PATCH] Decode HTML entities in POI titles --- app/helpers/posts_helper.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index ea113fa..b7605ba 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -12,7 +12,7 @@ module PostsHelper } }, :text => { - :title => post.title, + :title => decode_entities(post.title), :description => clean_description(post.summary), :footnote => "From #{post.feed.title}" }, @@ -28,12 +28,15 @@ module PostsHelper } end + def decode_entities(s) + HTMLEntities.new.decode s + end + def clean_description(s) if s.size > 137 s = s[0..136] + '...' end - coder = HTMLEntities.new - coder.decode(s.gsub(/<.+?>/, '')) + decode_entities(s.gsub(/<.+?>/, '')) end end