class Plate::AttributeNode

Public Instance Methods

compile(compiler, parent = nil) click to toggle source
# File lib/plate/compiler.rb, line 107
def compile(compiler, parent = nil)
  compile_value
end
compile_value() click to toggle source
# File lib/plate/compiler.rb, line 80
def compile_value
  case value
  when 'blank'
    'target="_blank"'
  when /\Abtn/
    c = 'btn'

    c << ' btn-primary' if value =~ /\-primary/
    c << ' btn-default' if c == 'btn'

    c << ' btn-lg' if value =~ /\-lg/
    c << ' btn-sm' if value =~ /\-sm/
    c << ' btn-block' if value =~ /\-block/

    "class=\"#{c}\""
  when /spin(\-\d+\.*\d*)?/
    s = value.gsub(/spin\-?/, '')
    s = 1.5 if s.empty?
    animation = "animation: spin #{s}s linear infinite"
    "style=\"-webkit-#{animation}; #{animation}\""
  when 'inherit'
    'style="color: inherit"'
  else
    ''
  end
end