Sha256: 6360248f4d3eca6813b241329d1260e350ce512d980f6b2ca11175f0c30f0989

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 Bytes

Contents

require 'mumukit/core'
require 'redcarpet'

module Mumukit
  module ContentType
    module BaseContentType
      def format_exception(e)
        "#{title e.message}\n#{code e.backtrace.join("\n")}"
      end

      def to_html(content)
        Mumukit::ContentType::Sanitizer.sanitize(htmlize content).html_safe
      end
    end

    def self.parse(s)
      "Mumukit::ContentType::#{s.to_s.titlecase}".constantize
    rescue
      raise "unknown content_type #{s}"
    end

    def self.for(type)
      parse(type)
    end
  end
end

require_relative './content_type/sanitizer'
require_relative './content_type/emoji'
require_relative './content_type/markdown'
require_relative './content_type/with_markdown'
require_relative './content_type/plain'
require_relative './content_type/html'
require_relative './content_type/gobstones'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mumukit-content-type-1.4.0 lib/mumukit/content_type.rb