Skip to content

0.1.0

Compare
Choose a tag to compare
@madeindjs madeindjs released this 09 Dec 12:20
· 54 commits to master since this release

Initial release

In this first version you can only parse Html file represented by Crystagiri::HTML. You can instanciate it from :

doc = Crystagiri::HTML.new "<h1>Crystagiri is awesome!!</h1>"
doc = Crystagiri::HTML.from_file "README.md"
doc = Crystagiri::HTML.from_url "http://example.com/"

Then you can search all XML::Node by:

  • HTML tag
doc.tag("h2") { |node| puts node }
# => <h2> .. </h2>
# => <h2> .. </h2>
# => <h2> .. </h2>
  • HTML id
puts doc.at_id("main-content") 
# => <div id="main-content"> ... </div>
  • HTML class attribute
doc.class("summary") { |node| puts node }
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>