Class: ValueList

Inherits:
Node
  • Object
show all
Defined in:
lib/emerald/nodes/value_list.rb

Overview

Special rule for lists of images, styles, and scripts

Instance Method Summary collapse

Instance Method Details

#to_html(context) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/emerald/nodes/value_list.rb', line 9

def to_html(context)
  list_items.elements.map do |e|
    case keyword.text_value
    when 'images'  then "<img src=\"#{e.literal.to_html(context)}\"/>"
    when 'styles'  then "<link rel=\"stylesheet\" href=\"#{e.literal.to_html(context)}\"/>"
    when 'scripts' then "<script type=\"text/javascript\" src=\"#{e.literal.to_html(context)}\"></script>"
    end
  end.join("\n")
end