summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2015-03-11 18:41:36 +0000
committerMarin Jankovski <marin@gitlab.com>2015-03-11 18:41:36 +0000
commit1647994adade890fbb2d8276c1bb99e6ec909fb8 (patch)
tree2a5743c358b353141aca444969bc4bdbeedcd99c /lib
parentb2f656796179d4ea8ef3295fa4cf2c6780bcd25e (diff)
parent4218a2bfcf7a3f864268c3eafe8ead28bb7808d8 (diff)
downloadgitlab-ce-1647994adade890fbb2d8276c1bb99e6ec909fb8.tar.gz
Merge branch 'fix-code-preview' into 'master'
Fix code preview theme setting for comments, issues, merge requests, and snippets User color scheme was not being used: default white color scheme was always chosen. Also, default background for code in notes was always overriding the user color scheme. Closes #1139 See merge request !357
Diffstat (limited to 'lib')
-rw-r--r--lib/redcarpet/render/gitlab_html.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 714261f815c..713d7c39a11 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -3,8 +3,9 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
attr_reader :template
alias_method :h, :template
- def initialize(template, options = {})
+ def initialize(template, color_scheme, options = {})
@template = template
+ @color_scheme = color_scheme
@project = @template.instance_variable_get("@project")
@options = options.dup
super options
@@ -34,7 +35,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
end
formatter = Rugments::Formatters::HTML.new(
- cssclass: "code highlight white #{lexer.tag}"
+ cssclass: "code highlight #{@color_scheme} #{lexer.tag}"
)
formatter.format(lexer.lex(code))
end