An Html parser library for Crystal (like Nokogiri for Ruby)
News
Crystagiri::Tag
API #13 (thanks to @giuseongit )News:
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:
doc.tag("h2") { |node| puts node }
# => <h2> .. </h2>
# => <h2> .. </h2>
# => <h2> .. </h2>
puts doc.at_id("main-content")
# => <div id="main-content"> ... </div>
doc.class("summary") { |node| puts node }
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>
new feature
doc.css("#main-content ol.steps") {|node| puts node}
# => <ol class="steps"> .. </ol>
doc.css("#body>quote.introduction") {|node| puts node}
# => <quote class="introduction"> .. </quote>
Corrections
Crystagiri::HTML.class
method as Crystagiri::HTML.where_class
.Crystagiri::HTML.tag
into Crystagiri::HTML.where_tag
Crystagiri::HTML.css
feature
Crystagiri::Tag
class who include a XML::Node
variable and add more usefull methodCorrection
Correction
Correction