2018-12-13 14:17:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-03-15 13:35:34 -04:00
|
|
|
# TODO: Delete when https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/26107
|
|
|
|
# exchange this parser by `Gitlab::Diff::SuggestionsParser`.
|
2018-12-13 14:17:19 -05:00
|
|
|
module Banzai
|
|
|
|
module SuggestionsParser
|
|
|
|
# Returns the content of each suggestion code block.
|
|
|
|
#
|
|
|
|
def self.parse(text)
|
|
|
|
html = Banzai.render(text, project: nil, no_original_data: true)
|
|
|
|
doc = Nokogiri::HTML(html)
|
|
|
|
|
|
|
|
doc.search('pre.suggestion').map { |node| node.text }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|