-
Notifications
You must be signed in to change notification settings - Fork 122
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
Problems including Asciidoctor Diagrams for PDF and EPUB #391
Comments
This was a known bug that has since been fixed. See asciidoctor/asciidoctor#3283 and asciidoctor/asciidoctor-epub3#188. In short, use Asciidoctor >= 2.0.9.
This has been fixed in Asciidoctor PDF 1.5.0.alpha.17. See asciidoctor/asciidoctor-pdf#1033 |
Not sure if it can help but I solved it using You can check it at https://gitlab.com/puravida-asciidoctor/asciidoctor-amazon-template |
@ianflett Thanks for reporting this inconsistency. I'll have a look into it. In the meantime I suggest to use the two settings that @jagedn has suggested. @mojavelinux It is not possible to use Asciidoctorj 2.0 (which will have Asciidoctor 2) with the 2.x version of the Gradle plugin when additional GEMs are involved. This is due to the API change in Asciidoctorj 2.0. For this 3.0.0-alpha.1 will be required. I cannot guarantee that the same inconsistency does not exist in 3.x as I have not tested that yet. |
in my project there is a 3.0.0-alpha.1 branch where I use this version of the plugin and I think we still need these settings but not sure if I'm using last versions of pdf. |
Default versions in 3.0.0-alpha.1 are listed here ->
and default versions in 2.2.0 are here -> Line 62 in 9203ed1
|
It's still possible to implement what I suggested with 1.5.8. It's just necessary to set the |
Thanks for all the responses, and sorry for the delay getting back. I could only get the PDF working with @jagedn's code; the EPUB didn't seem to open, but I might have done something wrong. Using the However, it appears using the new 3.0.0-alpha.2, the PDF's now working without the extra configuration. |
@ianflett So there is still an outstanding issue on EPUB? |
Yes, it appears so. Since your last comment I've tried ruling out user error, but I'm still experiencing problems:
I've also updated my test project to reflect what I'm testing: https://github.com/ianflett/test-asciidoctor |
Some thing I have noticed on this
|
If I understand things properly, there is no way to use Asciidoctor >= 2.0.9 from Gradle, because asciidoctor-gradle-plugin doesn't use Asciidoctor directly, but instead depends on AsciidoctorJ. But, the latest release of AsciidoctorJ is 2.0.0 and it includes Asciidoctor 2.0.8 instead of required Asciidoctor >= 2.0.9. Worse, even when AsciidoctorJ with Asciidoctor >= 2.0.9 is released, I am not aware of any way how asciidoctor-gradle-plugin user is able to specify what AsciidoctorJ version to use. So, seems like we need to wait for a new release of AsciidoctorJ, then bump AsciidoctorJ dependency in asciidoctor-gradle-plugin, then release a new version of asciidoctor-gradle-plugin and only then Overrall, "in short, use Asciidoctor >= 2.0.9" solution doesn't work because there is no way asciidoctor-gradle-plugin user can do that. Please, correct me if I am wrong and there exists a way to specify what version of Asciidoctor (without J) to use through asciidoctor-gradle-plugin. |
@slonopotamus You are correct. We need a new release of AsciidoctorJ (2.0.1) to collect all the bug fixes from Asciidoctor. |
@mojavelinux nice. And is there any open issue similar to asciidoctor/asciidoctor-pdf#1033 for asciidoctor-epub3? With asciidoctor-gragle-plugin 3.0.x, ditaa in PDF works out of the box, but we still need to specify |
I believe it was addressed here: asciidoctor/asciidoctor-epub3#188 (comment) |
Thinking about it we should probably set a default for imagesoutdir for epub & pdf. User can always override if necessary. We want the final output dir to be as pristine as possible. |
The imagesoutdir should be computed automatically from the output directory and the imagesdir. If it is not (perhaps because the output directory is not set in the document options), only then would you need to set the imageoutdir. For details, see https://github.com/asciidoctor/asciidoctor-diagram/blob/master/lib/asciidoctor-diagram/extensions.rb#L254-L267 |
Fresh attempt. I'm using: asciidoctorj 2.1.0 (includes asciidoctor 2.0.10) HTML/PDF just works, without any hacks. EPUB no longer warns about I tried to explicitly set
Sooo... Seems like even if I use latest releases of all components, ditaa still doesn't properly work for EPUB. @mojavelinux how PDF knows that it needs to search images both in |
Add asciidoctor {
useIntermediateWorkDir()
} This will place everything that is needed in an intermediate directory before processing. In that way ditaa should no longer write images to |
|
@slonopotamus Rename your chapter files not to be underscore-led. I cannot remember the original motivation for this, but for some reason in asciidoctor past, files startign with underscores are not valid. Maybe @mojavelinux can remember. See: Line 663 in cd528cc
|
Undercore is a default pattern used by asciidoctor-gradle-plugin to determine which files to convert, that's why I used it for chapters. Chapters are only meant to be included, but not processed on their own as standalone documents. |
Just to support @slonopotamus, that was my experience with chapter includes too. I originally tried without underscores and received feedback that led me to add them. |
💡 That's a bug in the Gradle plugin. Those files will need to be copied. #410 created for that. @slonopotamus To workaround that in the interim until we release 3.0.0-alpha.4 I present you with a terrible hack asciidoctorEpub {
useIntermediateWorkDir()
resources {
from sourceDir, {
include '_*.adoc'
}
} Yes, I had to use resources to get around the problem for now. |
One more attempt:
But... EPUB still doesn't work! It turns out, there's one more bug in it, asciidoc-epub doesn't handle absolute image paths: asciidoctor/asciidoctor-epub3#199 |
Thanks people for the effort you are putting in to using EPUB. Some good bugs have been discovered. EPUB has definitely not received the same amount of love as a project as PDF. |
3.0.0-alpha.3 contains AsciidoctorJ 2.10 which uses Asciidoctor 2.0.10.
3.0.0-alpha.3 uses asciidoctorj-df 1.5.0-alpha.17 by default.
Will be fixed in 3.0.0-alpha.4
Also addressed in 3.0.0-alpha.4. I am closing this one. If you find an issue post 3.0.0-alpha.4 please open a new issue. |
While trying to produce documentation in PDF or EPUB format, I've had problems using Asciidoctor Diagram.
With the
asciidoctor
task, everything just works. However, withasciidoctorPdf
, the diagram is expected in theimagedir
folder from the project root. WithasciidoctorEpub
the expectation is the same, except it fails to find the filed
(i.e. the first character of the generated filename):Additionally, it seems setting the folder between
asciidoctorPdf
andasciidoctorEpub
is inconsistent, apparent in mybuild.gradle
(below). I've added an example project to https://github.com/ianflett/test-asciidoctor.The text was updated successfully, but these errors were encountered: