Sha256: a744f994a98234806c2104654d1dd55afe82a81a8d3b5185993eb1cb6276d5e7

Contents?: true

Size: 535 Bytes

Versions: 5

Compression:

Stored size: 535 Bytes

Contents

module Mumukit::ContentType::Html
  extend Mumukit::ContentType::BaseContentType

  def self.title(title)
    "<strong>#{title}</strong>"
  end

  def self.code(code)
    "<pre>#{code}</pre>"
  end

  def self.htmlize(content, _options)
    content
  end

  def self.name
    'html'
  end

  def self.enumerate(items)
    add_list_tags(items) unless items.empty?
    items.join("\n")
  end

  private

  def self.add_list_tags(items)
    items.map! { |it| "<li>#{it}</li>" }
    items.prepend '<ul>'
    items.append '</ul>'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mumukit-content-type-1.12.1 lib/mumukit/content_type/html.rb
mumukit-content-type-1.12.0 lib/mumukit/content_type/html.rb
mumukit-content-type-1.11.1 lib/mumukit/content_type/html.rb
mumukit-content-type-1.11.0 lib/mumukit/content_type/html.rb
mumukit-content-type-1.10.0 lib/mumukit/content_type/html.rb