diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-05-14 13:05:33 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-05-14 13:05:33 +0200 |
commit | cd52cef1c0898230cb684ee294bd7a6c5b2f226a (patch) | |
tree | eb55e471d7d5e3d626f266b77f6931c708e145d4 /lib | |
parent | 910794bae5a91479f41468ebc345db680a33b20e (diff) | |
download | gitlab-ce-cd52cef1c0898230cb684ee294bd7a6c5b2f226a.tar.gz |
Fix reference links in dashboard activity and ATOM feeds.dashboard-references
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/markdown.rb | 16 | ||||
-rw-r--r-- | lib/redcarpet/render/gitlab_html.rb | 5 |
2 files changed, 13 insertions, 8 deletions
diff --git a/lib/gitlab/markdown.rb b/lib/gitlab/markdown.rb index cc68416d5fc..4b45f239ce5 100644 --- a/lib/gitlab/markdown.rb +++ b/lib/gitlab/markdown.rb @@ -24,10 +24,10 @@ module Gitlab # Public: Parse the provided text with GitLab-Flavored Markdown # # text - the source text - # project - the project + # options - options # html_options - extra options for the reference links as given to link_to - def gfm(text, project = @project, html_options = {}) - gfm_with_options(text, {}, project, html_options) + def gfm(text, options = {}, html_options = {}) + gfm_with_options(text, options, html_options) end # Public: Parse the provided text with GitLab-Flavored Markdown @@ -38,7 +38,7 @@ module Gitlab # :reference_only_path - Use relative path for reference links # project - the project # html_options - extra options for the reference links as given to link_to - def gfm_with_options(text, options = {}, project = @project, html_options = {}) + def gfm_with_options(text, options = {}, html_options = {}) return text if text.nil? # Duplicate the string so we don't alter the original, then call to_str @@ -48,7 +48,9 @@ module Gitlab options.reverse_merge!( xhtml: false, - reference_only_path: true + reference_only_path: true, + project: @project, + current_user: current_user ) pipeline = HTML::Pipeline.new(filters) @@ -62,9 +64,9 @@ module Gitlab no_header_anchors: options[:no_header_anchors], # ReferenceFilter - current_user: current_user, + current_user: options[:current_user], only_path: options[:reference_only_path], - project: project, + project: options[:project], reference_class: html_options[:class], # RelativeLinkFilter diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 15eb6effe08..7dcecc2ecf6 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -7,9 +7,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML def initialize(template, color_scheme, options = {}) @template = template @color_scheme = color_scheme - @project = @template.instance_variable_get("@project") @options = options.dup + @options.reverse_merge!( + project: @template.instance_variable_get("@project") + ) + super(options) end |