class Crystagiri::HTML

Overview

Represent an Html document who can be parsed

Defined in:

crystagiri/html.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.from_file(path : String) : HTML #

Initialize an Html object from content of file designed by the given filepath


[View source]
def self.from_url(url : String, follow : Bool = false) : HTML #

Initialize an Html object from Html source fetched from the url


[View source]
def self.new(content : String) #

Initialize an Html object from Html source


[View source]

Class Method Detail

def self.css_query_to_xpath(query : String) : String #

Transform the css query into an xpath query


[View source]

Instance Method Detail

def at_css(query : String) #

Find first node corresponding to the css query and return Crystagiri::Tag if founded or a nil if not founded


[View source]
def at_id(id_name : String) : Crystagiri::Tag? #

Find a node by its id and return a Crystagiri::Tag founded or a nil if not founded


[View source]
def at_tag(tag_name : String) : Crystagiri::Tag? #

Find first tag by tag name and return Crystagiri::Tag founded or a nil if not founded


[View source]
def content : String #

[View source]
def css(query : String, &block) : Array(Tag) #

Find all node corresponding to the css query and yield Crystagiri::Tag founded or a nil if not founded


[View source]
def nodes : XML::Node #

[View source]
def where_class(class_name : String, &block) : Array(Tag) #

Find all nodes by classname and yield Crystagiri::Tag founded


[View source]
def where_tag(tag_name : String, &block) : Array(Tag) #

Find all nodes by tag name and yield Crystagiri::Tag founded


[View source]