lib/makeup/markup.rb in makeup-0.1.1 vs lib/makeup/markup.rb in makeup-0.2.0

- old
+ new

@@ -25,10 +25,24 @@ require "github/markup" require "makeup/code_block_parser" require "makeup/syntax_highlighter" module Makeup + # Ugly work-around to access GitHub::Markup's @@markups without + # monkey-patching the module. + module GitHubMarkupAccessor + include GitHub::Markup + + def self.markups + @@supported ||= (@@markups.keys.map do |key| + key.to_s.match(/\(\?-mix:(.*)\)/)[1].split("|").map do |s| + { :suffix => "*.#{s}" } + end + end).flatten + end + end + class NoopHighlighter def highlight(path, code, options = {}) lexer = options[:lexer] || path.split(".").last CodeBlock.new(lexer, code) end @@ -53,8 +67,12 @@ end end def self.can_render?(path) GitHub::Markup.can_render?(path) + end + + def self.markups + GitHubMarkupAccessor.markups end end end