Sha256: ed7433c2b2421e4532e8f38aae97cc32a31106e04832956bbacde4031637017d

Contents?: true

Size: 1.04 KB

Versions: 102

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true
module Nokogiri
  module HTML
    ###
    # 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::HTML::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

102 entries across 97 versions & 4 rubygems

Version Path
nokogiri-backport-1.11.0 lib/nokogiri/html/builder.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/lib/nokogiri/html/builder.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/lib/nokogiri/html/builder.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.7-x86_64-linux/lib/nokogiri/html/builder.rb
nokogiri-1.11.7 lib/nokogiri/html/builder.rb
nokogiri-1.11.7-x86_64-linux lib/nokogiri/html/builder.rb
nokogiri-1.11.7-x86_64-darwin lib/nokogiri/html/builder.rb
nokogiri-1.11.7-x86-mingw32 lib/nokogiri/html/builder.rb
nokogiri-1.11.7-x86-linux lib/nokogiri/html/builder.rb
nokogiri-1.11.7-x64-mingw32 lib/nokogiri/html/builder.rb
nokogiri-1.11.7-java lib/nokogiri/html/builder.rb
nokogiri-1.11.7-arm64-darwin lib/nokogiri/html/builder.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.1-x86_64-linux/lib/nokogiri/html/builder.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.6-x86_64-linux/lib/nokogiri/html/builder.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.6-x86_64-linux/lib/nokogiri/html/builder.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.3-x86_64-linux/lib/nokogiri/html/builder.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.1-x86_64-linux/lib/nokogiri/html/builder.rb
nokogiri-1.11.6 lib/nokogiri/html/builder.rb
nokogiri-1.11.6-x86_64-linux lib/nokogiri/html/builder.rb
nokogiri-1.11.6-x86_64-darwin lib/nokogiri/html/builder.rb