class HTMLwithSyntaxHighlighter
Public Instance Methods
block_code(code, lang)
click to toggle source
# File lib/mamemose.rb, line 25 def block_code(code, lang) highlight = defined?(SYNTAX_HIGHLIGHT) ? SYNTAX_HIGHLIGHT : :coderay lang ||= 'plain' if highlight == :syntaxhighlighter code = HTMLEntities.new.encode(code) "<pre class='brush: #{lang}'>#{code}</pre>" else CodeRay.scan(code, lang.to_sym).div(:line_numbers => :table) end end