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
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-10-14 20:27:23 +0300
committerDouwe Maan <douwe@gitlab.com>2015-10-14 20:28:09 +0300
commited41333a6ecbfcc04781a47a3dc71064c92d837b (patch)
tree5494ebea76f0191288a0adfed404745a3112bf75 /lib/gitlab/reference_extractor.rb
parent4a5b77188ec7525d1c3a1ee925c8791f841b040c (diff)
Use Gitlab::Markdown.render with :pipeline option rather than different methods
Diffstat (limited to 'lib/gitlab/reference_extractor.rb')
-rw-r--r--lib/gitlab/reference_extractor.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 66016ecc877..633c988d025 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -13,7 +13,8 @@ module Gitlab
def analyze(text)
references.clear
- @text = Gitlab::Markdown.render_without_gfm(text)
+
+ @document = Gitlab::Markdown.render(text, project: project)
end
%i(user label issue merge_request snippet commit commit_range).each do |type|
@@ -44,20 +45,13 @@ module Gitlab
filter = Gitlab::Markdown.const_get(klass)
context = {
- project: project,
- current_user: current_user,
-
- # We don't actually care about the links generated
- only_path: true,
- ignore_blockquotes: true,
-
- # ReferenceGathererFilter
+ project: project,
+ current_user: current_user,
load_lazy_references: false,
reference_filter: filter
}
- pipeline = HTML::Pipeline.new([filter, Gitlab::Markdown::ReferenceGathererFilter], context)
- result = pipeline.call(@text)
+ result = self.class.pipeline.call(@document, context)
values = result[:references][filter_type].uniq
@@ -67,5 +61,9 @@ module Gitlab
values
end
+
+ def self.pipeline
+ @pipeline ||= HTML::Pipeline.new([Gitlab::Markdown::ReferenceGathererFilter])
+ end
end
end