Sha256: 947c9785e343df8ed5cdf2ab5e308195f2db71723f4f07680195ac1a4178b255

Contents?: true

Size: 573 Bytes

Versions: 5

Compression:

Stored size: 573 Bytes

Contents

module BootstrapEmail
  module Component
    class Padding < Base
      def build
        each_node('*[class*=p-], *[class*=pt-], *[class*=pr-], *[class*=pb-], *[class*=pl-], *[class*=px-], *[class*=py-]') do |node|
          next if ['table', 'td', 'a'].include?(node.name)

          padding_regex = /(p[trblxy]?-\d+)/
          classes = node['class'].scan(padding_regex).join(' ')
          node['class'] = node['class'].gsub(padding_regex, '')
          node.replace(template('table', classes: classes, contents: node.to_html))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bootstrap-email-1.0.0.alpha2.1 lib/bootstrap-email/components/padding.rb
bootstrap-email-1.0.0.alpha2 lib/bootstrap-email/components/padding.rb
bootstrap-email-1.0.0.alpha1.2 lib/bootstrap-email/components/padding.rb
bootstrap-email-1.0.0.alpha1.1 lib/bootstrap-email/components/padding.rb
bootstrap-email-1.0.0.alpha1 lib/bootstrap-email/components/padding.rb