diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 6b81748..32c6cc8 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -10,6 +10,7 @@ For a detailed view of what has changed, refer to the {uri-repo}/commits/master[ * fix crash when running in environments with non-Unicode locale (#475) * update Font Awesome Solid to 6.6.0 * add support for https://docs.asciidoctor.org/asciidoctor/latest/convert/templates/[Converter Templates] (#487) +* properly handle absolute image paths (#465) == 2.1.3 (2024-05-12) - @slonopotamus diff --git a/spec/fixtures/image-with-abspath/book.adoc b/spec/fixtures/image-with-abspath/book.adoc new file mode 100644 index 0000000..2cbd334 --- /dev/null +++ b/spec/fixtures/image-with-abspath/book.adoc @@ -0,0 +1,4 @@ += Image with absolute path +:imagesdir: {docdir} + +image::./circle.svg[] diff --git a/spec/fixtures/image-with-abspath/circle.svg b/spec/fixtures/image-with-abspath/circle.svg new file mode 100644 index 0000000..3e8733f --- /dev/null +++ b/spec/fixtures/image-with-abspath/circle.svg @@ -0,0 +1,3 @@ + + + diff --git a/spec/image_spec.rb b/spec/image_spec.rb index 4200e24..6588bc2 100644 --- a/spec/image_spec.rb +++ b/spec/image_spec.rb @@ -30,6 +30,15 @@ expect(book).to have_item_with_href('imagez/wolpertinger.jpg') end + # Test for https://github.com/asciidoctor/asciidoctor-epub3/issues/465 + it 'supports absolute image paths' do + book, out_file = to_epub fixture_file('image-with-abspath/book.adoc') + out_dir = out_file.dirname + + expect(out_dir.join('circle.svg')).to exist + expect(book).to have_item_with_href('circle.svg') + end + it 'does not duplicate images in manifest' do book, = to_epub fixture_file('inline-image/book.adoc') expect(book.items.keys.select { |k| k.include? 'wolpertinger' }.size).to eq(1)