Sha256: ac162256bb6845663be6edbeb5482081cbb32e0244e9597d1e4ff85d84e22f80

Contents?: true

Size: 506 Bytes

Versions: 115

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

115 entries across 111 versions & 10 rubygems

Version Path
actiontext-7.0.8.7 lib/action_text/html_conversion.rb
actiontext-7.0.8.6 lib/action_text/html_conversion.rb
actiontext-6.1.7.10 lib/action_text/html_conversion.rb
actiontext-6.1.7.9 lib/action_text/html_conversion.rb
actiontext-7.0.8.5 lib/action_text/html_conversion.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/actiontext-7.0.8.4/lib/action_text/html_conversion.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/lib/action_text/html_conversion.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/lib/action_text/html_conversion.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/actiontext-7.0.5.1/lib/action_text/html_conversion.rb
actiontext-7.0.8.4 lib/action_text/html_conversion.rb
actiontext-6.1.7.8 lib/action_text/html_conversion.rb
actiontext-7.0.8.1 lib/action_text/html_conversion.rb
actiontext-6.1.7.7 lib/action_text/html_conversion.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-7.0.2.3/lib/action_text/html_conversion.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-7.0.3.1/lib/action_text/html_conversion.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/actiontext-6.1.6.1/lib/action_text/html_conversion.rb
actiontext-7.0.8 lib/action_text/html_conversion.rb
actiontext-7.0.7.2 lib/action_text/html_conversion.rb
actiontext-6.1.7.6 lib/action_text/html_conversion.rb
actiontext-7.0.7.1 lib/action_text/html_conversion.rb