Commit 2bf08a48 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'extract-ee-specific-banzai-filters' into 'master'

Extract EE-specific lines from Banzai pipelines

Closes #6065

See merge request gitlab-org/gitlab-ee!6518
parents f8567af4 8c2df842
module EE
module Banzai
module Pipeline
module GfmPipeline
extend ActiveSupport::Concern
class_methods do
def reference_filters
[
::Banzai::Filter::EpicReferenceFilter,
*super
]
end
end
end
end
end
end
module EE
module Banzai
module Pipeline
module PostProcessPipeline
extend ActiveSupport::Concern
class_methods do
def internal_link_filters
[
*super,
::Banzai::Filter::CrossProjectIssuableInformationFilter
]
end
end
end
end
end
end
module EE
module Banzai
module Pipeline
module SingleLinePipeline
extend ActiveSupport::Concern
class_methods do
def reference_filters
[
::Banzai::Filter::EpicReferenceFilter,
*super
]
end
end
end
end
end
end
module Banzai module Banzai
module Pipeline module Pipeline
class GfmPipeline < BasePipeline class GfmPipeline < BasePipeline
prepend EE::Banzai::Pipeline::GfmPipeline
# These filters convert GitLab Flavored Markdown (GFM) to HTML. # These filters convert GitLab Flavored Markdown (GFM) to HTML.
# The handlers defined in app/assets/javascripts/behaviors/markdown/copy_as_gfm.js # The handlers defined in app/assets/javascripts/behaviors/markdown/copy_as_gfm.js
# consequently convert that same HTML to GFM to be copied to the clipboard. # consequently convert that same HTML to GFM to be copied to the clipboard.
...@@ -24,7 +26,17 @@ module Banzai ...@@ -24,7 +26,17 @@ module Banzai
Filter::AutolinkFilter, Filter::AutolinkFilter,
Filter::ExternalLinkFilter, Filter::ExternalLinkFilter,
Filter::EpicReferenceFilter, *reference_filters,
Filter::TaskListFilter,
Filter::InlineDiffFilter,
Filter::SetDirectionFilter
]
end
def self.reference_filters
[
Filter::UserReferenceFilter, Filter::UserReferenceFilter,
Filter::IssueReferenceFilter, Filter::IssueReferenceFilter,
Filter::ExternalIssueReferenceFilter, Filter::ExternalIssueReferenceFilter,
...@@ -33,12 +45,7 @@ module Banzai ...@@ -33,12 +45,7 @@ module Banzai
Filter::CommitRangeReferenceFilter, Filter::CommitRangeReferenceFilter,
Filter::CommitReferenceFilter, Filter::CommitReferenceFilter,
Filter::LabelReferenceFilter, Filter::LabelReferenceFilter,
Filter::MilestoneReferenceFilter, Filter::MilestoneReferenceFilter
Filter::TaskListFilter,
Filter::InlineDiffFilter,
Filter::SetDirectionFilter
] ]
end end
......
module Banzai module Banzai
module Pipeline module Pipeline
class PostProcessPipeline < BasePipeline class PostProcessPipeline < BasePipeline
prepend EE::Banzai::Pipeline::PostProcessPipeline
def self.filters def self.filters
FilterArray[ @filters ||= FilterArray[
*internal_link_filters,
Filter::AbsoluteLinkFilter
]
end
def self.internal_link_filters
[
Filter::RedactorFilter, Filter::RedactorFilter,
Filter::RelativeLinkFilter, Filter::RelativeLinkFilter,
Filter::IssuableStateFilter, Filter::IssuableStateFilter
Filter::CrossProjectIssuableInformationFilter,
Filter::AbsoluteLinkFilter
] ]
end end
......
module Banzai module Banzai
module Pipeline module Pipeline
class SingleLinePipeline < GfmPipeline class SingleLinePipeline < GfmPipeline
prepend EE::Banzai::Pipeline::SingleLinePipeline
def self.filters def self.filters
@filters ||= FilterArray[ @filters ||= FilterArray[
Filter::HtmlEntityFilter, Filter::HtmlEntityFilter,
...@@ -10,7 +12,12 @@ module Banzai ...@@ -10,7 +12,12 @@ module Banzai
Filter::AutolinkFilter, Filter::AutolinkFilter,
Filter::ExternalLinkFilter, Filter::ExternalLinkFilter,
Filter::EpicReferenceFilter, *reference_filters
]
end
def self.reference_filters
[
Filter::UserReferenceFilter, Filter::UserReferenceFilter,
Filter::IssueReferenceFilter, Filter::IssueReferenceFilter,
Filter::ExternalIssueReferenceFilter, Filter::ExternalIssueReferenceFilter,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment