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-12-15 17:51:16 +0300
committerDouwe Maan <douwe@gitlab.com>2015-12-15 17:51:16 +0300
commit7781bda9bd82997f4a03de4cf911b1156ceb2cde (patch)
treea632a12b295694232205e2190f784f9bb79235ee /spec/support/filter_spec_helper.rb
parent9451db3819ae45734c4343e55a74d347cdacf70d (diff)
Move Markdown/reference logic from Gitlab::Markdown to Banzai
Diffstat (limited to 'spec/support/filter_spec_helper.rb')
-rw-r--r--spec/support/filter_spec_helper.rb36
1 files changed, 18 insertions, 18 deletions
diff --git a/spec/support/filter_spec_helper.rb b/spec/support/filter_spec_helper.rb
index 91e3bee13c1..d6e03cbef3d 100644
--- a/spec/support/filter_spec_helper.rb
+++ b/spec/support/filter_spec_helper.rb
@@ -1,4 +1,4 @@
-# Helper methods for Gitlab::Markdown filter specs
+# Helper methods for Banzai filter specs
#
# Must be included into specs manually
module FilterSpecHelper
@@ -10,49 +10,49 @@ module FilterSpecHelper
# if none is provided.
#
# html - HTML String to pass to the filter's `call` method.
- # contexts - Hash context for the filter. (default: {project: project})
+ # context - Hash context for the filter. (default: {project: project})
#
# Returns a Nokogiri::XML::DocumentFragment
- def filter(html, contexts = {})
+ def filter(html, context = {})
if defined?(project)
- contexts.reverse_merge!(project: project)
+ context.reverse_merge!(project: project)
end
- described_class.call(html, contexts)
+ described_class.call(html, context)
end
# Run text through HTML::Pipeline with the current filter and return the
# result Hash
#
# body - String text to run through the pipeline
- # contexts - Hash context for the filter. (default: {project: project})
+ # context - Hash context for the filter. (default: {project: project})
#
# Returns the Hash
- def pipeline_result(body, contexts = {})
- contexts.reverse_merge!(project: project) if defined?(project)
+ def pipeline_result(body, context = {})
+ context.reverse_merge!(project: project) if defined?(project)
- pipeline = HTML::Pipeline.new([described_class], contexts)
+ pipeline = HTML::Pipeline.new([described_class], context)
pipeline.call(body)
end
- def reference_pipeline(contexts = {})
- contexts.reverse_merge!(project: project) if defined?(project)
+ def reference_pipeline(context = {})
+ context.reverse_merge!(project: project) if defined?(project)
filters = [
- Gitlab::Markdown::AutolinkFilter,
+ Banzai::Filter::AutolinkFilter,
described_class,
- Gitlab::Markdown::ReferenceGathererFilter
+ Banzai::Filter::ReferenceGathererFilter
]
- HTML::Pipeline.new(filters, contexts)
+ HTML::Pipeline.new(filters, context)
end
- def reference_pipeline_result(body, contexts = {})
- reference_pipeline(contexts).call(body)
+ def reference_pipeline_result(body, context = {})
+ reference_pipeline(context).call(body)
end
- def reference_filter(html, contexts = {})
- reference_pipeline(contexts).to_document(html)
+ def reference_filter(html, context = {})
+ reference_pipeline(context).to_document(html)
end
# Modify a String reference to make it invalid