class Inkcite::Renderer::ContainerBase

Protected Instance Methods

mix_all(element, opt, ctx) click to toggle source
# File lib/inkcite/renderer/container_base.rb, line 7
def mix_all element, opt, ctx

  mix_animation element, opt, ctx
  mix_background element, opt, ctx
  mix_border element, opt, ctx
  mix_border_radius element, opt, ctx
  mix_font element, opt, ctx
  mix_margins element, opt, ctx
  mix_text_align element, opt, ctx

  # Supports both integers and mixed padding (e.g. 10px 20px)
  padding = opt[:padding]
  unless none?(padding)
    paddingpx = px(padding)
    element.style[:padding] = paddingpx

    # Copy the padding into the MSO custom padding attribute for high-DPI
    # compatibility
    paddingpx = "#{paddingpx} #{paddingpx} #{paddingpx} #{paddingpx}" unless paddingpx.include?(' ')
    element.style[MSO_PADDING_ALT] = paddingpx

  end


  # Vertical alignment - top, middle, bottom.
  valign = opt[:valign]
  element.style[VERTICAL_ALIGN] = valign unless none?(valign)

  display = opt[:display]
  element.style[:display] = display unless display.blank?

  # If boolean 'nowrap' attribute is present, apply the 'white-space: nowrap'
  # style to the element.
  element.style[WHITE_SPACE] = :nowrap if opt[:nowrap]

  # Support for mobile-padding and mobile-padding-(direction)
  mix_mobile_padding element, opt, ctx

  # White space wrapping can be controlled with mobile-no-wrap or mobile-wrap
  mobile_white_space = (:nowrap if opt[MOBILE_NOWRAP]) || (:normal if opt[MOBILE_WRAP])
  element.mobile_style[WHITE_SPACE] = mobile_white_space unless mobile_white_space.nil?

  mix_responsive element, opt, ctx

  element.to_s
end
mix_height(element, opt, ctx) click to toggle source
# File lib/inkcite/renderer/container_base.rb, line 54
def mix_height element, opt, ctx

  height = opt[:height].to_i
  element.style[:height] = px(height) if height > 0

  mobile_height = opt[MOBILE_HEIGHT].to_i
  element.mobile_style[:height] = px(mobile_height) if mobile_height > 0

end
mix_width(element, opt, ctx) click to toggle source
# File lib/inkcite/renderer/container_base.rb, line 64
def mix_width element, opt, ctx

  width = opt[:width]
  element.style[:width] = px(width) unless width.blank?

  mobile_width = opt[MOBILE_WIDTH]
  element.mobile_style[:width] = px(mobile_width) unless mobile_width.blank?

end