Sha256: 36bc13bd676e2cf3dc96d84abd944bb1a0fc3a08c2eb060cb1f08a9c446006e0
Contents?: true
Size: 916 Bytes
Versions: 18
Compression:
Stored size: 916 Bytes
Contents
# frozen_string_literal: true class Premailer module Adapter # Decidim adapter for Premailer module Decidim include ::Premailer::Adapter::Nokogiri # Converts the HTML document to a format suitable for plain-text e-mail. # # If present, uses the <body> element as its base; otherwise uses the whole document. # # Customized for Decidim in order to strip the inline <style> tags away # from the plain text body. # # @return [String] a plain text. def to_plain_text html_src = begin @doc.css("style").remove @doc.at("body").inner_html rescue StandardError "" end unless html_src && html_src.present? @doc.css("style").remove html_src = @doc.to_html end convert_to_text(html_src, @options[:line_length], @html_encoding) end end end end
Version data entries
18 entries across 18 versions & 1 rubygems