Sha256: f029048c33e3445c53c74dd1338760723de9f1e22ba071f93de34d9d08dd2802

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

module MiniSyntax
  module Version
    MAJOR = 0
    MINOR = 2
    PATCH = 0
    BUILD = nil

    STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
  end

  @@languages = {}

  def self.register(lang, lang_module)
    @@languages[lang] = lang_module
  end

  def self.highlight(code, lang)
    if highlighter = @@languages[lang.to_sym]
      highlighter.highlight(code)
    elsif lang.is_a?(String)
      lang.split(/\s*\+\s*/).each do |lang|
        code = highlight(code, lang.strip.to_sym)
      end
      code
    else
      code
    end
  end
end

require 'minisyntax/highlighter'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minisyntax-0.2.0 lib/minisyntax.rb