Sha256: ac162256bb6845663be6edbeb5482081cbb32e0244e9597d1e4ff85d84e22f80

Contents?: true

Size: 506 Bytes

Versions: 116

Compression:

Stored size: 506 Bytes

Contents

# frozen_string_literal: true

module ActionText
  module HtmlConversion
    extend self

    def node_to_html(node)
      node.to_html(save_with: Nokogiri::XML::Node::SaveOptions::AS_HTML)
    end

    def fragment_for_html(html)
      document.fragment(html)
    end

    def create_element(tag_name, attributes = {})
      document.create_element(tag_name, attributes)
    end

    private
      def document
        Nokogiri::HTML::Document.new.tap { |doc| doc.encoding = "UTF-8" }
      end
  end
end

Version data entries

116 entries across 112 versions & 11 rubygems

Version Path
actiontext-6.0.4 lib/action_text/html_conversion.rb
actiontext-6.0.3.7 lib/action_text/html_conversion.rb
actiontext-6.1.3.2 lib/action_text/html_conversion.rb
actiontext-6.1.3.1 lib/action_text/html_conversion.rb
actiontext-6.0.3.6 lib/action_text/html_conversion.rb
actiontext-6.1.3 lib/action_text/html_conversion.rb
actiontext-6.1.2.1 lib/action_text/html_conversion.rb
actiontext-6.0.3.5 lib/action_text/html_conversion.rb
actiontext-6.1.2 lib/action_text/html_conversion.rb
actiontext-6.1.1 lib/action_text/html_conversion.rb
actiontext-6.1.0 lib/action_text/html_conversion.rb
actiontext-6.1.0.rc2 lib/action_text/html_conversion.rb
actiontext-6.1.0.rc1 lib/action_text/html_conversion.rb
actiontext-6.0.3.4 lib/action_text/html_conversion.rb
actiontext-6.0.3.3 lib/action_text/html_conversion.rb
actiontext-6.0.3.2 lib/action_text/html_conversion.rb
actiontext-6.0.3.1 lib/action_text/html_conversion.rb
actiontext-6.0.3 lib/action_text/html_conversion.rb
actiontext-6.0.3.rc1 lib/action_text/html_conversion.rb
actiontext-6.0.2.2 lib/action_text/html_conversion.rb