module Asciidoctor::Image
Constants
- Base64Encoded
- DataUriRx
- FormatAliases
Public Class Methods
Source
# File lib/asciidoctor/pdf/ext/asciidoctor/image.rb, line 9 def self.format image_path ((ext = ::File.extname image_path).downcase.slice 1, ext.length) end
Source
# File lib/asciidoctor/pdf/ext/asciidoctor/image.rb, line 13 def self.target_and_format image_path, attributes = nil if (image_path.start_with? 'data:') && (m = DataUriRx.match image_path) [(m[:data].extend Base64Encoded), (FormatAliases.fetch m[:fmt], m[:fmt])] else [image_path, attributes&.[]('format') || ((ext = ::File.extname image_path).downcase.slice 1, ext.length)] end end
Public Instance Methods
Source
# File lib/asciidoctor/pdf/ext/asciidoctor/image.rb, line 21 def target_and_format image_path = inline? ? target : (attr 'target') if (image_path.start_with? 'data:') && (m = DataUriRx.match image_path) [(m[:data].extend Base64Encoded), (FormatAliases.fetch m[:fmt], m[:fmt])] else [image_path, (attr 'format', nil, false) || ((ext = ::File.extname image_path).downcase.slice 1, ext.length)] end end