Sha256: f3a5aaebdb3b6f34c91e4241f13817cd330c1a3b24f514d7809d6d6c9d740fcb

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'treetop'
require_relative 'node'

# Special rule for lists of images, styles, and scripts
class ValueList < Node
  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
emerald-lang-1.0.0 lib/emerald/nodes/value_list.rb