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
images in tables are not pulled into the archive #5
Comments
There are two sources of this problem. First, the converter does not pull in inline images because they aren't available in the AST after a parse atm. If the images are changed to be block images, then it still won't find them because find_by doesn't currently look in AsciiDoc table cells. Here are the lines in question: |
For now, here's the logic that's needed.
|
I suppose we'll eventually want to support this in find_by, but it's definitely a rough-in. For now, it might be best just to put it in asciidoctor-epub3 as a stop-gap measure. |
Feel free to attempt a patch if you get to it before me. |
I've decided to solve this by using the document catalog instead of the AST. We already have the limitation that the imagesdir cannot be changed within a chapter file, so we have enough information to be able to reconstruct the path to the image from the value in document catalog alone. In order to make this work, we have to set the catalog_assets option on the document to true. Fortunately, we control the loading of each chapter file in the spine processor, so we can set additional options. (See asciidoctor-epub3/lib/asciidoctor-epub3/spine_item_processor.rb Lines 50 to 58 in 9c241f6
One problem we're going to run into is that, as of 1.5.6.1, core does not pass the catalog_assets option to nested documents (e.g., an AsciiDoc table cell). There's no easy way around this limitation. Therefore, images in AsciiDoc table cells will not be included until that is fixed in core (slated for 1.5.7). |
I also needed to add SVG support for inline images in the converter and set a max-width value for inline images. I decided to add the class |
* enable catalog_assets option on documents in spine * read images from catalog (i.e., references) table * move call to add_content_images method inside add_content method * add svg to epub properties list if an inline SVG image is detected * set width of inline image to value of scaledwidth attribute, if specified ** if scaledwidth attribute is not specified and image is an SVG, set value to 100% * add inline class to inline image elements * add max-width: 100% style to all images (not just figures) * group figure.image styles together in stylesheet
Please note if you are reading this that images in AsciiDoc table cells will not be included unless you are using at least Asciidoctor (core) 1.5.7 (and it has been released, of course). |
You can recreate this by building the book at vromero/mule-doc@4eed0f1. The list discussion is at http://discuss.asciidoctor.org/Asciidoc-EPUB3-and-local-images-td1936.html
The text was updated successfully, but these errors were encountered: