diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-10-14 21:18:49 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-10-14 21:18:49 +0300 |
commit | b093cb35d1614a48e980c5ccfca3a8d307d732f7 (patch) | |
tree | 1342da63d6e7ec388d5190c881eb777542263880 /lib/gitlab/reference_extractor.rb | |
parent | da9746e59a46005a0948d34bfd94ae715143c3f7 (diff) |
Use Gitlab::Markdown for Asciidoc and ReferenceExtractor pipelines
Diffstat (limited to 'lib/gitlab/reference_extractor.rb')
-rw-r--r-- | lib/gitlab/reference_extractor.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb index 2262e5a168a..f34bf7d1d0e 100644 --- a/lib/gitlab/reference_extractor.rb +++ b/lib/gitlab/reference_extractor.rb @@ -14,7 +14,8 @@ module Gitlab def analyze(text, cache_key: nil) references.clear - @document = Gitlab::Markdown.render(text, project: project, cache_key: cache_key) + @pipeline = Gitlab::Markdown.cached?(cache_key, pipeline: :full) ? :full : :plain_markdown + @html = Gitlab::Markdown.render(text, project: project, cache_key: cache_key, pipeline: @pipeline) end %i(user label issue merge_request snippet commit commit_range).each do |type| @@ -45,14 +46,19 @@ module Gitlab filter = Gitlab::Markdown.const_get(klass) context = { - project: project, - current_user: current_user, + pipeline: [:reference_extraction], + + project: project, + current_user: current_user, + + # ReferenceGathererFilter load_lazy_references: false, reference_filter: filter } - result = self.class.pipeline.call(@document, context) + context[:pipeline].unshift(filter) unless @pipeline == :full + result = Gitlab::Markdown.render_result(@html, context) values = result[:references][filter_type].uniq if @load_lazy_references @@ -61,9 +67,5 @@ module Gitlab values end - - def self.pipeline - @pipeline ||= HTML::Pipeline.new([Gitlab::Markdown::ReferenceGathererFilter]) - end end end |