Sha256: ac9b13e5e0b32a6f2550d7aa979a78b53a725bccbc039b2a0a4986c9a7b1baaf
Contents?: true
Size: 714 Bytes
Versions: 5
Compression:
Stored size: 714 Bytes
Contents
module Asciidoctor module Image DataUriRx = /^data:image\/(?<fmt>png|jpe?g|gif|pdf|bmp|tiff);base64,(?<data>.*)$/ class << self def format path, node = nil (node && (node.attr 'format', nil, false)) || (::File.extname path).downcase[1..-1] end end def format (attr 'format', nil, false) || ::File.extname(inline? ? target : (attr 'target')).downcase[1..-1] end def target_and_format image_path = inline? ? target : (attr 'target') if (image_path.start_with? 'data:') && (m = DataUriRx.match image_path) [(m[:data].extend ::Base64), m[:fmt]] else [image_path, (attr 'format', nil, false) || (::File.extname image_path).downcase[1..-1]] end end end end
Version data entries
5 entries across 5 versions & 1 rubygems