Sha256: 3fa8109d28244f7012cd2906f5067788767556458c59df0e82e10905650fbac1

Contents?: true

Size: 815 Bytes

Versions: 9

Compression:

Stored size: 815 Bytes

Contents

module BootstrapEmail
  module Converter
    class Stack < Base
      def build
        stack_row
        stack_col
      end

      def stack_row
        each_node('.stack-row') do |node|
          html = ''
          node.xpath('./*').each do |child|
            html += template('td', classes: 'stack-cell', contents: child.to_html)
          end
          node.replace(template('table-to-tr', classes: node['class'], contents: html))
        end
      end

      def stack_col
        each_node('.stack-col') do |node|
          html = ''
          node.xpath('./*').each do |child|
            html += template('tr', classes: 'stack-cell', contents: child.to_html)
          end
          node.replace(template('table-to-tbody', classes: node['class'], contents: html))
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bootstrap-email-1.1.4 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.3 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.2 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.1 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.0.2 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.0.1 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.0.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.0.0.alpha4 lib/bootstrap-email/converters/stack.rb