Class: Microformat::SchemaOrg
- Inherits:
-
Object
- Object
- Microformat::SchemaOrg
- Defined in:
- lib/microformat.rb
Class Method Summary collapse
Class Method Details
.parse(html, opts = {}) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/microformat.rb', line 107 def self.parse(html, opts={}) strict = opts.has_key? :strict ? opts[:strict] : true html = Nokogiri::HTML.parse html unless html.respond_to? :search scopes = html.search('//*[@itemscope and not(@itemprop)]') .map { |node| ItemScope.new node, strict } if scopes.any? ItemDocument.new scopes else nil end end |