Sha256: dfbfc407adb7b96a9793d4b62f89a073b16ebee0e28d8042bd73c68a581394c4

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 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

2 entries across 2 versions & 1 rubygems

Version Path
bootstrap-email-1.1.4 lib/bootstrap-email/converters/support_url_tokens.rb
bootstrap-email-1.1.3 lib/bootstrap-email/converters/support_url_tokens.rb