module Asciidoctor::Image
Constants
- DataUriRx
Public Class Methods
format(path, node = nil)
click to toggle source
# File lib/asciidoctor-pdf/asciidoctor_ext/image.rb, line 6 def format path, node = nil (node && (node.attr 'format', nil, false)) || (::File.extname path).downcase[1..-1] end
Public Instance Methods
format()
click to toggle source
# File lib/asciidoctor-pdf/asciidoctor_ext/image.rb, line 11 def format (attr 'format', nil, false) || ::File.extname(inline? ? target : (attr 'target')).downcase[1..-1] end
target_and_format()
click to toggle source
# File lib/asciidoctor-pdf/asciidoctor_ext/image.rb, line 15 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