class

Lexbor::Parser

Inherits Reference < Object

Constructors

new(ec : EncodingConverter, page : String)
Source
new(ec : EncodingConverter, io : IO)
Source
new(page : String)
Source
new(slice : Slice)
Source
new(io : IO)
Source

Instance methods

body
Source
body!
Source
create_node(tag_id : Lexbor::Lib::TagIdT)

Create a new node

Note: this does not add the node to any document or tree. It only creates the object that can then be appended or inserted. See Node#append_child, Node#insert_after, and Node#insert_before

doc = Lexbor::Parser.new ""
div = doc.create_node(:div)
a = doc.create_node(:a)

div.to_html # <div></div>
a.to_html   # <a></a>
Source
create_node(tag_sym : Symbol)
Source
create_node(tag_name : String)
Source
create_text_node(text : String)
Source
css(*args, **options)

Css selectors, see Node#css

Source
css(*args, **options, &)

Css selectors, see Node#css

Source
document
Source
document!
Source
finalize
Source
free
Source
head
Source
head!
Source
html
Source
html!
Source
nodes(tag_id : Lexbor::Lib::TagIdT)

Top level node filter (select all nodes in tree with tag_id) returns Lexbor::Iterator::Collection equal with lexbor.root!.scope.nodes(...)

lexbor.nodes(Lexbor::Lib::TagIdT::LXB_TAG_DIV).each { |node| ... }

Source
nodes(tag_sym : Symbol)

Top level node filter (select all nodes in tree with tag_sym) returns Lexbor::Iterator::Collection equal with lexbor.root!.scope.nodes(...)

lexbor.nodes(:div).each { |node| ... }

Source
nodes(tag_str : String)

Top level node filter (select all nodes in tree with tag_sym) returns Lexbor::Iterator::Collection equal with lexbor.root!.scope.nodes(...)

lexbor.nodes("div").each { |node| ... }

Source
root
Source
root!
Source
to_html(*args, **options)

Convert html tree to html string, see Node#to_html

Source
to_html(*args, **options, &)

Convert html tree to html string, see Node#to_html

Source
to_pretty_html(*args, **options)
Source
to_pretty_html(*args, **options, &)
Source