Method: IsoDoc::HtmlFunction::Html#image_suffix

Defined in:
lib/isodoc/html_function/postprocess.rb

#image_suffix(img) ⇒ Object



108
109
110
111
112
113
114
# File 'lib/isodoc/html_function/postprocess.rb', line 108

def image_suffix(img)
  type = img["mimetype"]&.sub(%r{^[^/*]+/}, "")
  matched = /\.(?<suffix>[^. \r\n\t]+)$/.match img["src"]
  type and !type.empty? and return type
  !matched.nil? and matched[:suffix] and return matched[:suffix]
  "png"
end