Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-07-24 03:45:08 +0400
committerRiyad Preukschas <riyad@informatik.uni-bremen.de>2012-08-01 19:37:12 +0400
commite1b4e22e5c59b9ef97892515755627857ae87185 (patch)
tree785880fba7cdf059184a4fc619ad90fd1e594221 /lib
parent058b71edf3eed2aa2f4f664a0731e52c57b157ce (diff)
Add render context to markdown renderer
Diffstat (limited to 'lib')
-rw-r--r--lib/redcarpet/render/gitlab_html.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 638c227cb20..6530adf012f 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -1,4 +1,14 @@
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'})