简体   繁体   English

Rails使用simple_format解析RSS Feed Feedzirra / Feedjira

[英]Rails Parsing RSS Feed Feedzirra / Feedjira with simple_format

I'm using Feedjira (Feedzirra) https://github.com/feedjira/feedjira to parse rss feeds in rails. 我正在使用Feedjira(Feedzirra) https://github.com/feedjira/feedjira来解析RSS提要。

I need a way to remove html tags from the title of the rss feed items before I save to database. 我需要一种在保存到数据库之前从rss feed项的标题中删除html标签的方法。

in my create method which saves the feed item to the database 在我的创建方法中,该提要将提要项保存到数据库中

:title => feed_items_url.title

I tried to add simple_format to this but it didn't work 我试图向其中添加simple_format,但是没有用

:name => simple_format(feed_items_url.title)

使用nokogiri和方法text可从您的内容中剥离HTML标记。

@doc.title().text

Rails具有用于带状HTML标签的内置帮助器: strip_tags

strip_tags(feed_items_url.title)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM