Sha256: df99a26f4182d7a3676c1ffa26a5c0d249c455318e8c1ecb7cf7d9252edef606
Contents?: true
Size: 448 Bytes
Versions: 11
Compression:
Stored size: 448 Bytes
Contents
module HTML class Pipeline # 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=""/>. class ImageFilter < TextFilter def call @text.gsub(/(https|http)?:\/\/.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?/i) do |match| %(<img src="#{match}" alt=""/>) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems