diff --git a/lib/html_pipeline/text_filter/image_filter.rb b/lib/html_pipeline/text_filter/image_filter.rb
index b95045dd..59e2bd66 100644
--- a/lib/html_pipeline/text_filter/image_filter.rb
+++ b/lib/html_pipeline/text_filter/image_filter.rb
@@ -9,7 +9,7 @@ class TextFilter
# .
class ImageFilter < TextFilter
- def call(text)
+ def call(text, context: {}, result: {})
text.gsub(%r{(https|http)?://.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?}i) do |match|
%()
end
diff --git a/lib/html_pipeline/text_filter/plain_text_input_filter.rb b/lib/html_pipeline/text_filter/plain_text_input_filter.rb
index 6a796662..ab8f015d 100644
--- a/lib/html_pipeline/text_filter/plain_text_input_filter.rb
+++ b/lib/html_pipeline/text_filter/plain_text_input_filter.rb
@@ -5,7 +5,7 @@ class TextFilter
# Simple filter for plain text input. HTML escapes the text input and wraps it
# in a div.
class PlainTextInputFilter < TextFilter
- def call(text)
+ def call(text, context: {}, result: {})
"
#{CGI.escapeHTML(text)}
"
end
end
diff --git a/lib/html_pipeline/version.rb b/lib/html_pipeline/version.rb
index 325f4c46..07f6fc2f 100644
--- a/lib/html_pipeline/version.rb
+++ b/lib/html_pipeline/version.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
class HTMLPipeline
- VERSION = "3.1.0"
+ VERSION = "3.1.1"
end
diff --git a/test/html_pipeline/text_filter/plain_text_input_filter_test.rb b/test/html_pipeline/text_filter/plain_text_input_filter_test.rb
index d53db0aa..0454c6f6 100644
--- a/test/html_pipeline/text_filter/plain_text_input_filter_test.rb
+++ b/test/html_pipeline/text_filter/plain_text_input_filter_test.rb
@@ -27,5 +27,15 @@ def test_html_escapes_plain_text_input
doc.to_s,
)
end
+
+ def test_works_within_complete_pipeline
+ pipeline = HTMLPipeline.new(text_filters: [HTMLPipeline::TextFilter::PlainTextInputFilter.new])
+ result = pipeline.call("See: ")
+
+ assert_equal(
+ "See: <http://example.org>
",
+ result[:output],
+ )
+ end
end
end
diff --git a/test/text_filter_test.rb b/test/text_filter_test.rb
new file mode 100644
index 00000000..f2e365ff
--- /dev/null
+++ b/test/text_filter_test.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require "test_helper"
+require "html_pipeline/text_filter/image_filter"
+
+ImageFilter = HTMLPipeline::TextFilter::ImageFilter
+
+class HTMLPipeline
+ class ImageFilterTest < Minitest::Test
+ def setup
+ @filter = ImageFilter
+ end
+
+ def test_jpg
+ assert_equal(
+ %(),
+ @filter.call(%(http://example.com/test.jpg)),
+ )
+ end
+
+ def test_jpeg
+ assert_equal(
+ %(),
+ @filter.call(%(http://example.com/test.jpeg)),
+ )
+ end
+
+ def test_bmp
+ assert_equal(
+ %(),
+ @filter.call(%(http://example.com/test.bmp)),
+ )
+ end
+
+ def test_gif
+ assert_equal(
+ %(),
+ @filter.call(%(http://example.com/test.gif)),
+ )
+ end
+
+ def test_png
+ assert_equal(
+ %(),
+ @filter.call(%(http://example.com/test.png)),
+ )
+ end
+
+ def test_https_url
+ assert_equal(
+ %(),
+ @filter.call(%(https://example.com/test.png)),
+ )
+ end
+ end
+end