crystagiri alternatives and similar shards
Based on the "Misc" category.
Alternatively, view crystagiri alternatives based on common mentions on social networks and blogs.
-
sentry
Build/Runs your crystal application, watches files, and rebuilds/restarts app on file changes -
immutable
Thread-safe, persistent, immutable collections for the Crystal language -
crz
Functional programming library for https://github.com/crystal-lang/crystal -
crystal-web-framework-stars
โญ๏ธ Web frameworks for Crystal, most starred on Github -
cron_scheduler
Simple job scheduler with crontab patterns for Crystal Language. -
crystal-futures
Future type implementation for Crystal language -
inflector.cr
Inflector shard for Crystal. A port of ActiveSupport::Inflector -
aasm.cr
:arrows_clockwise: Easy to use finite state machine for Crystal classes -
kreal
Kreal is a model sharing & RPC library built on and works with Kemal seamlessly. -
retriable.cr
Retriable.cr is a simple DSL to retry failed code blocks -
ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Crystal -
CrSerializer
Extensible annotation based serialization/deserialization library -
circuit_breaker
Implementation of the circuit breaker pattern in crystal -
burocracia.cr
๐ Zero-dependency Crystal shard to validate, generate and format Brazilian burocracias (CPF, CNPJ, CEP) -
wikicr
Wiki in crystal, using Markdown and Git, inspired by dokuwiki. Last features to build are pretty hard, if you have some time to help... :) -
m3u8
Generate and parse m3u8 playlists for HTTP Live Streaming (HLS) in Crystal. -
message_verifier.cr
Rails compatible MessageVerifier for Crystal-lang apps -
defined
This shard provides facilities for checking whether a constant exists at compile time, and for a variety of different conditional compilation options. Code can be conditionally compiled based on the existence of a constant, version number constraints, or whether an environment variable is set truthy or not.
Learn any GitHub repo in 59 seconds
Do you think we are missing an alternative of crystagiri or a related project?
README
Crystagiri
An HTML parser library for Crystal like the amazing Nokogiri Ruby gem.
I won't pretend that Crystagiri does much as Nokogiri. All help is welcome! :)
Installation
Add this to your application's shard.yml
:
dependencies:
crystagiri:
github: madeindjs/crystagiri
and then run
$ shards install
Usage
require "crystagiri"
Then you can simply instantiate a Crystagiri::HTML
object from an HTML String
like this
doc = Crystagiri::HTML.new "<h1>Crystagiri is awesome!!</h1>"
... or directly load it from a Web URL or a pathname:
doc = Crystagiri::HTML.from_file "README.md"
doc = Crystagiri::HTML.from_url "http://example.com/"
Also you can specify
follow: true
flag if you want to follow redirect URL
Then you can search all XML::Node
s from the Crystagiri::HTML
instance. The tags found will be Crystagiri::Tag
objects with the .node
property:
- CSS query
puts doc.css("li > strong.title") { |tag| puts tag.node}
# => <strong class="title"> .. </strong>
# => <strong class="title"> .. </strong>
Known limitations: Currently, you can't use CSS queries with complex search specifiers like
:nth-child
- HTML tag
doc.where_tag("h2") { |tag| puts tag.content }
# => Development
# => Contributing
- HTML id
puts doc.at_id("main-content").tagname
# => div
- HTML class attribute
doc.where_class("summary") { |tag| puts tag.node }
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>
# => <div class="summary"> .. </div>
Benchmark
I know you love benchmarks between Ruby & Crystal, so here's one:
require "nokogiri"
t1 = Time.now
doc = Nokogiri::HTML File.read("spec/fixture/HTML.html")
1..100000.times do
doc.at_css("h1")
doc.css(".step-title"){ |tag| tag }
end
puts "executed in #{Time.now - t1} milliseconds"
executed in 00:00:11.10 seconds with Ruby 2.6.0 with RVM on old Mac
require "crystagiri"
t = Time.now
doc = Crystagiri::HTML.from_file "./spec/fixture/HTML.html"
1..100000.times do
doc.at_css("h1")
doc.css(".step-title") { |tag| tag }
end
puts "executed in #{Time.now - t} milliseconds"
executed in 00:00:03.09 seconds on Crystal 0.27.2 on LLVM 6.0.1 with release flag
Crystagiri is more than two time faster than Nokogiri!!
Development
Clone this repository and navigate to it:
$ git clone https://github.com/madeindjs/crystagiri.git
$ cd crystagiri
You can generate all documentation with
$ crystal doc
And run spec tests to ensure everything works correctly
$ crystal spec
Contributing
Do you like this project? here you can find some issues to get started.
Contributing is simple:
- Fork it ( https://github.com/madeindjs/crystagiri/fork )
- Create your feature branch
git checkout -b my-new-feature
- Commit your changes
git commit -am "Add some feature"
- Push to the branch
git push origin my-new-feature
- Create a new Pull Request
Contributors
See the list on Github