Sha256: 8993a4ffdbf7e9c8ce7b3dde8f454a35c92bbd5b3d23f320c681c6a7962083b4

Contents?: true

Size: 481 Bytes

Versions: 4

Compression:

Stored size: 481 Bytes

Contents

module BootstrapEmail
  module Converter
    class SupportUrlTokens < Base
      OPEN_BRACKETS = CGI.escape('{{').freeze
      CLOSE_BRACKETS = CGI.escape('}}').freeze

      def self.replace(html)
        regex = /((href|src)=(\"|\'))((#{Regexp.quote(OPEN_BRACKETS)}).*?(#{Regexp.quote(CLOSE_BRACKETS)}))(\"|\')/
        if regex.match?(html)
          html.gsub!(regex) do |match|
            "#{$1}#{CGI.unescape($4)}#{$7}"
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootstrap-email-1.1.2 lib/bootstrap-email/converters/support_url_tokens.rb
bootstrap-email-1.1.1 lib/bootstrap-email/converters/support_url_tokens.rb
bootstrap-email-1.1.0 lib/bootstrap-email/converters/support_url_tokens.rb
bootstrap-email-1.0.2 lib/bootstrap-email/converters/support_url_tokens.rb