Skip to content

Commit

Permalink
resolves asciidoctor#465 properly handle absolute image paths
Browse files Browse the repository at this point in the history
  • Loading branch information
slonopotamus committed Jan 12, 2025
1 parent c4df3b0 commit b2462b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions spec/fixtures/image-with-abspath/book.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= Image with absolute path
:imagesdir: {docdir}

image::./circle.svg[]
3 changes: 3 additions & 0 deletions spec/fixtures/image-with-abspath/circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions spec/image_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b2462b1

Please sign in to comment.