Class: Nokogiri::HTML5::Builder
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
::Nokogiri::XML::Builder
|
|
|
Instance Chain:
|
|
| Inherits: |
Nokogiri::XML::Builder
|
| Defined in: | lib/nokogiri/html5/builder.rb |
Overview
::Nokogiri HTML5 builder is used for building ::Nokogiri::HTML documents. It is very similar to the ::Nokogiri::XML::Builder. In fact, you should go read the documentation for ::Nokogiri::XML::Builder before reading this documentation.
The construction behavior is identical to ::Nokogiri::HTML4::Builder, but ::Nokogiri::HTML5 documents implement the [HTML5 standard’s serialization algorithm](www.w3.org/TR/2008/WD-html5-20080610/serializing.html).
Synopsis:
Create an ::Nokogiri::HTML5 document with a body that has an onload attribute, and a span tag with a class of “bold” that has content of “Hello world”.
builder = Nokogiri::HTML5::Builder.new do |doc|
doc.html {
doc.body(:onload => 'some_func();') {
doc.span.bold {
doc.text "Hello world"
}
}
}
end
puts builder.to_html
The HTML5 builder inherits from the ::Nokogiri::XML builder, so make sure to read the ::Nokogiri::XML::Builder documentation.
Constant Summary
::Nokogiri::ClassResolver - Included
::Nokogiri::XML::Builder - Inherited
Class Method Summary
::Nokogiri::XML::Builder - Inherited
Instance Attribute Summary
::Nokogiri::XML::Builder - Inherited
Instance Method Summary
-
#to_html
Convert the builder to
::Nokogiri::HTML.
::Nokogiri::XML::Builder - Inherited
| #<< | Append the given raw |
| #[] | Build a tag that is associated with namespace |
| #cdata | Create a CDATA Node with content of |
| #comment | Create a Comment Node with content of |
| #text | Create a Text Node with content of |
| #to_xml | Convert this |
| #bind_ns, | |
| #insert | Insert |
| #method_missing | |
::Nokogiri::ClassResolver - Included
| #related_class | Find a class constant within the. |
Constructor Details
This class inherits a constructor from Nokogiri::XML::Builder
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nokogiri::XML::Builder
Instance Method Details
#to_html
Convert the builder to ::Nokogiri::HTML
# File 'lib/nokogiri/html5/builder.rb', line 35
def to_html @doc.to_html end