Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #465 properly handle absolute image paths #488

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading