瀏覽代碼

Decode HTML entities in POI titles

master
Adrian Short 12 年之前
父節點
當前提交
92af4bd772
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. +6
    -3
      app/helpers/posts_helper.rb

+ 6
- 3
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

Loading…
取消
儲存