开发者

How to remove the RSS feed images

In my rails application, i parsed the RSS feed, the feed contains Images & text but i only want to display text only . I don't know how to skip the images from display.

I tried to apply a style to image => display : none. unfort开发者_JAVA百科unately it doesn't work. can anyone tell how to do this .

My code is as following :

in controller :

@rss = RSS::Parser.parse(open('http://mysite/entries/rss').read, false)

In my view :

"<% @rss.items[(0..2)].each do |rss| %>"

"<%= rss.description %> "

"<%end%>"


You could remove the image tags with

@description.gsub(/<img .*?>/i, '')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜