No commit activity in last 3 years
No release in over 3 years
hpricot helper that scrapes html easily by parser class defined css selector
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme
css_parser
==========

  hpricot helper that scrapes html easily by parser class defined css selector


Example
=======

  class UserParser < CssParser
    css :name, "div#contents span.name"
    css :age , "div#contents span.age"
  end

  parser = UserParser.file('user.html')
  User.new parser.attributes


Formatter
=========

"css" accepts :as option to specify output format.
Let's consider following html.

  <span class=name>
    Maiha
    <span class=nick>(maiha)</span>
  </span>

When the case of :html formatter, this is in default.

  class UserParser < CssParser
    css :name, "span.name"
  end

  UserParser.new(html).name
  # => "Maiha\n<span class=\"nick\">(maiha)</span>"

When the case of :text formatter.

  class UserParser < CssParser
    css :name, "span.name", :as=>:text
  end

  UserParser.new(html).name
  # => "Maiha\n    (maiha)"



Copyright (c) 2008 maiha@wota.jp, released under the MIT license