Sha256: 0bce69280724408ee0207d1e3b76113fdcd9166b68cabfb09ebfc7c420110bc5
Contents?: true
Size: 488 Bytes
Versions: 9
Compression:
Stored size: 488 Bytes
Contents
# frozen_string_literal: true class HTMLPipeline class TextFilter # 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(%r{(https|http)?://.+\.(jpg|jpeg|bmp|gif|png)(\?\S+)?}i) do |match| %(<img src="#{match}" alt=""/>) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems