Permalink
Browse files

Switch from hpricot/mofo to nokogiri/prism

  • Loading branch information...
1 parent 52fa1bd commit 4608198989cf9e8ee2f212b240139db49ae0a2fe @atd atd committed Apr 5, 2010
Showing with 13 additions and 10 deletions.
  1. +2 −2 README.rdoc
  2. +11 −8 lib/station/html.rb
View
@@ -76,7 +76,7 @@ You can add AtomPub support for Articles creation. You must implement params_fro
* mislav-will_paginate
* ruby-openid (optional)
* atom-tools (optional)
- * hpricot (optional)
+ * nokogiri, prism (optional)
* Rails Plugins:
* attachment_fu
* exception_notification (optional)
@@ -102,7 +102,7 @@ You can install this aditional gems:
* ruby-openid, for OpenID authentication support
* atom-tools, for AtomPub support
-* hpricot, for HTML discovery
+* nokogiri, prism, for HTML management, Microformats discovery
== TODO
View
@@ -1,5 +1,5 @@
-{ 'hpricot' => 'HTML introspection',
- 'mofo' => 'Microformats' }.each_pair do |gem, support|
+{ 'nokogiri' => 'HTML introspection',
+ 'prism' => 'Microformats' }.each_pair do |gem, support|
begin
require gem
rescue MissingSourceFile
@@ -17,11 +17,11 @@ def initialize(text)
end
def doc
- @doc ||= Hpricot(@text)
+ @doc ||= Nokogiri::HTML(@text)
end
def head_links
- doc.search('//link')
+ doc.xpath('//head/link')
end
def feeds
@@ -70,17 +70,20 @@ def foaf?
foaf_links.any?
end
- def microformats
- Microformat.find :text => text
+ # Find available Microformats for this HTML
+ #
+ # Needs the {prism}[http://github.com/mwunsch/prism] gem
+ def microformats(format = nil)
+ Prism.find text, format
rescue
Array.new
end
# Find hCard in this HTML
#
- # Needs the {mofo}[http://mofo.rubyforge.org/] gem
+ # Needs the {prism}[http://github.com/mwunsch/prism] gem
def hcard
- hCard.find :text => text
+ microformats(:hcard)
rescue
nil
end

0 comments on commit 4608198

Please sign in to comment.