Class: BootstrapEmail::Converter::Spacing

Inherits:
Base
  • Object
show all
Defined in:
lib/bootstrap-email/converters/spacing.rb

Instance Attribute Summary

Attributes inherited from Base

#doc

Instance Method Summary collapse

Methods inherited from Base

build, #initialize

Constructor Details

This class inherits a constructor from BootstrapEmail::Converter::Base

Instance Method Details

#buildObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/bootstrap-email/converters/spacing.rb', line 6

def build
  each_node('*[class*=space-y-]') do |node|
    spacer = node['class'].scan(/space-y-((lg-)?\d+)/)[0][0]
    # get all direct children except the first
    node.xpath('./*[position() < last()] | ./tbody/tr/td/*[position() < last()]').each do |child|
      next if margin_bottom?(child)

      add_class(child, "mb-#{spacer}")
    end
  end
end