开发者

How to remove the RSS feed images

开发者 https://www.devze.com 2023-02-15 00:45 出处:网络
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.

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

精彩评论

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