Class: BootstrapEmail::Converter::Padding
- Defined in:
- lib/bootstrap-email/converters/padding.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from BootstrapEmail::Converter::Base
Instance Method Details
#build ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bootstrap-email/converters/padding.rb', line 6 def build each_node("*[class^=p-], *[class^=pt-], *[class^=pr-], *[class^=pb-], *[class^=pl-], *[class^=px-], *[class^=py-], *[class*=' p-'], *[class*=' pt-'], *[class*=' pr-'], *[class*=' pb-'], *[class*=' pl-'], *[class*=' px-'], *[class*=' py-']") do |node| next if %w[table td a].include?(node.name) padding_regex = /(p[trblxy]?-(lg-)?\d+)/ classes = node['class'].gsub(padding_regex).to_a.join(' ') node['class'] = node['class'].gsub(padding_regex, '').strip node.replace(template('table', classes: classes, contents: node.to_html)) end end |