Sha256: 1691ee2d86224dd86b89fa2b704cbb75adbe8b44871f322213a51f9c1f9b586e

Contents?: true

Size: 1.25 KB

Versions: 66

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

module Nokogiri
  module HTML5
    ###
    # Nokogiri HTML5 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.
    #
    # The construction behavior is identical to HTML4::Builder, but HTML5 documents implement the
    # [HTML5 standard's serialization
    # algorithm](https://www.w3.org/TR/2008/WD-html5-20080610/serializing.html).
    #
    # == Synopsis:
    #
    # Create an 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 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

66 entries across 66 versions & 1 rubygems

Version Path
nokogiri-1.18.0-aarch64-linux-musl lib/nokogiri/html5/builder.rb
nokogiri-1.18.0-aarch64-linux-gnu lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-x86_64-linux-musl lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-x86_64-linux-gnu lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-x86_64-darwin lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-x64-mingw-ucrt lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-java lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1 lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-arm-linux-musl lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-arm-linux-gnu lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-arm64-darwin lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-aarch64-linux-musl lib/nokogiri/html5/builder.rb
nokogiri-1.18.0.rc1-aarch64-linux-gnu lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x86-mingw32 lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x86-linux lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x86_64-linux lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x86_64-darwin lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x64-mingw-ucrt lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-x64-mingw32 lib/nokogiri/html5/builder.rb
nokogiri-1.17.2-java lib/nokogiri/html5/builder.rb