forked from asciidoctor/asciidoctor-epub3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves asciidoctor#282 use imagedir from an image's context during …
…packaging resolves asciidoctor#169 images in tables don't show up resolves asciidoctor#190 plantumlconfig is looking in the wrong dir resolves asciidoctor#30 Inline images are not included
- Loading branch information
1 parent
47e2051
commit 6e5a15f
Showing
17 changed files
with
192 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= Diagrams book | ||
:doctype: book | ||
:plantumlconfig: ./plantuml.cfg | ||
|
||
include::subdir/chapter.adoc[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
' This file only exists to check that plantuml finds it in correct location without warnings' | ||
|
||
skinparam handwritten true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
== Diagrams | ||
:imagesdir: a | ||
|
||
[ditaa, "a"] | ||
.... | ||
+--+ | ||
|A | | ||
+--+ | ||
.... | ||
|
||
:imagesdir: b | ||
|
||
[ditaa, "b"] | ||
.... | ||
+--+ | ||
|B | | ||
+--+ | ||
.... | ||
|
||
:!imagesdir: | ||
|
||
[ditaa, "c"] | ||
.... | ||
+--+ | ||
|C | | ||
+--+ | ||
.... | ||
|
||
:imagesdir: d | ||
|
||
[plantuml] | ||
--------------------------------------------------------------------- | ||
@startuml | ||
title Accepting Payments: Blocking the GUI and Synchronous | ||
boundary "Web GUI" as GUI | ||
control "API" | ||
boundary "Payment Gateway" as PG | ||
GUI -> API: POST /payments | ||
API -> PG: POST /submitPaymentAttempt | ||
PG -> PG: May take 30-60s to confirm | ||
API <-- PG: HTTP 200 OK | ||
GUI <-- API: HTTP 200 OK | ||
@enduml | ||
--------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
= Inline images | ||
:doctype: book | ||
:imagesdir: imagez | ||
|
||
include::subdir/chapter.adoc[] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
== Chapter | ||
|
||
A | ||
|
||
image:wolpertinger.jpg[] B | ||
|
||
Z | ||
|
||
[separator=¦] | ||
|=== | ||
a¦[ditaa, "inline-diag"] | ||
.... | ||
+--------------+ | ||
|Inline diagram| | ||
+--------------+ | ||
.... | ||
|=== | ||
|
||
[cols="1,1"] | ||
|=== | ||
a|image::square.png[] | ||
a|Do do see a red square on the left? | ||
|=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'spec_helper' | ||
require 'asciidoctor-diagram' | ||
|
||
describe 'Asciidoctor::Epub3::Converter - Images' do | ||
# safe-mode + (outdir != sourcedir) == jail violation in asciidoctor-diagram | ||
# See https://github.com/asciidoctor/asciidoctor-diagram/issues/262 | ||
diagram_safe_mode = Asciidoctor::SafeMode::UNSAFE | ||
|
||
it 'handles imagesoutdir != imagesdir != "{base_dir}/images"' do | ||
in_file = fixture_file 'diagram', 'book.adoc' | ||
out_dir = temp_file 'diagram' | ||
out_file = File.join out_dir, 'book.epub' | ||
Asciidoctor.convert_file in_file, | ||
to_dir: out_dir, | ||
backend: 'epub3', | ||
header_footer: true, | ||
mkdirs: true, | ||
safe: diagram_safe_mode | ||
expect(File).to exist(File.join(out_dir, 'a', 'a.png')) | ||
expect(File).to exist(File.join(out_dir, 'b', 'b.png')) | ||
expect(File).to exist(File.join(out_dir, 'c.png')) | ||
Zip::File.open out_file do |zip| | ||
expect(zip.find_entry('OEBPS/a/a.png')).not_to be_nil | ||
expect(zip.find_entry('OEBPS/b/b.png')).not_to be_nil | ||
expect(zip.find_entry('OEBPS/c.png')).not_to be_nil | ||
end | ||
end | ||
|
||
it 'handles inline images' do | ||
in_file = fixture_file 'inline-image', 'book.adoc' | ||
out_dir = temp_file 'inline-image' | ||
out_file = File.join out_dir, 'book.epub' | ||
Asciidoctor.convert_file in_file, | ||
to_dir: out_dir, | ||
backend: 'epub3', | ||
header_footer: true, | ||
mkdirs: true, | ||
safe: diagram_safe_mode | ||
expect(File).to exist(File.join(out_dir, 'imagez', 'inline-diag.png')) | ||
Zip::File.open out_file do |zip| | ||
expect(zip.find_entry('OEBPS/imagez/inline-diag.png')).not_to be_nil | ||
expect(zip.find_entry('OEBPS/imagez/square.png')).not_to be_nil | ||
expect(zip.find_entry('OEBPS/imagez/wolpertinger.jpg')).not_to be_nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters