gitlabhq/lib/redcarpet/render/gitlab_html.rb
Robert Speicher 7754189187 Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
2012-08-10 18:25:15 -04:00

24 lines
569 B
Ruby

class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
attr_reader :template
alias_method :h, :template
def initialize(template, options = {})
@template = template
@project = @template.instance_variable_get("@project")
super options
end
def block_code(code, language)
if Pygments::Lexer.find(language)
Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'})
else
Pygments.highlight(code, options: {encoding: 'utf-8'})
end
end
def postprocess(full_document)
h.gfm(full_document)
end
end