Sha256: e5bb7d57120886da41bda32188a2042ca6e5e4ab1cb2e89f2b1ebbfaca005d27

Contents?: true

Size: 1.04 KB

Versions: 61

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true
module Nokogiri
  module HTML4
    ###
    # Nokogiri HTML builder is used for building 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.
    #
    # == Synopsis:
    #
    # Create an HTML 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::HTML4::Builder.new do |doc|
    #     doc.html {
    #       doc.body(:onload => 'some_func();') {
    #         doc.span.bold {
    #           doc.text "Hello world"
    #         }
    #       }
    #     }
    #   end
    #   puts builder.to_html
    #
    # The HTML builder inherits from the XML builder, so make sure to read the
    # Nokogiri::XML::Builder documentation.
    class Builder < Nokogiri::XML::Builder
      ###
      # Convert the builder to HTML
      def to_html
        @doc.to_html
      end
    end
  end
end

Version data entries

61 entries across 61 versions & 4 rubygems

Version Path
nokogiri-1.12.0.rc1-arm64-darwin lib/nokogiri/html4/builder.rb