Sha256: faa29a526bd88b6b2c7dfbd4a4adfd0b16cad2a87bef127e904d09e2af64fa91

Contents?: true

Size: 846 Bytes

Versions: 10

Compression:

Stored size: 846 Bytes

Contents

# frozen_string_literal: true

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

10 entries across 10 versions & 1 rubygems

Version Path
bootstrap-email-1.5.1 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.5.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.4.1 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.4.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.3.1 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.3.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.2.0 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.7 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.6 lib/bootstrap-email/converters/stack.rb
bootstrap-email-1.1.5 lib/bootstrap-email/converters/stack.rb