Class: HTML::Pipeline::ImageFilter
- Inherits:
-
TextFilter
- Object
- Filter
- TextFilter
- HTML::Pipeline::ImageFilter
- Defined in:
- lib/html/pipeline_plus/image_filter.rb
Overview
HTML Filter that converts image’s url into <img> tag. For example, it will convert
http://example.com/test.jpg
into
<img src="http://example.com/test.jpg" alt=""/>.
Instance Attribute Summary
Attributes inherited from TextFilter
Attributes inherited from Filter
Instance Method Summary collapse
Methods inherited from TextFilter
Methods inherited from Filter
#base_url, call, #current_user, #doc, #has_ancestor?, #html, #initialize, #needs, #parse_html, #repository, to_document, to_html, #validate
Constructor Details
This class inherits a constructor from HTML::Pipeline::TextFilter
Instance Method Details
#call ⇒ Object
10 11 12 13 14 |
# File 'lib/html/pipeline_plus/image_filter.rb', line 10 def call @text.gsub(/(https|http)?:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match| %(<img src="#{match}" alt=""/>) end end |