gregturn / asciidoctor-packt

Backend and theme to convert Asciidoctor files into Packt Publishing OpenOffice doc
http://greglturnquist.com/category/learning-spring-boot
46 stars 13 forks source link

Image include issue #26

Closed verhas closed 3 years ago

verhas commented 3 years ago

I cannot have an inline image in the asciidoc file unless I know the aspect ratio. If I do not specify width and height then the picture will be a thumbnail.

If I say image:: .... [width="100%"]

then the height will be zero, and I get a line.

If I say image:: .... [width="100%" heigth="50%"]

then the image will be distorted based on the original aspect ratio and the size of the page (note 50% can be practically anything).

My workaround is that I have a python script that reads the width and the height from the SVG file and then inserts it automatically into the manuscript, but this is a hack.

gregturn commented 3 years ago

Since I'm not writing anymore books for Packt, I encourage you to fork the repo and tune it as desired for your own productions.

verhas commented 3 years ago

I was actually hoping for help. I do not code ruby, nor expert in how asciidoctor works. But far enough.

gregturn commented 3 years ago

I honestly am not sure how to do that.

My ruby skills are minimal. Plus, you're running stuff inside a rendering toolkit. So I'm not sure how to plugin code blocks that can run algorithms.

It's why I settled on having this things do as they presently do, and then amending the output, manually. And ultimately letting Packt typeset the images themselves.

Now that I'm publishing directly to Amazon using Asciidoctor with no intermedia formats (see https://amzn.to/36gLYCv), the entire process is much simpler.

verhas commented 3 years ago

Fair enough, and I get that this is not really something with the code that you created. Thanks for the answer.

I see that you also wrote non-technical novels. Not the type I read, but still, it is nice. I hope they sell.

My workflow is quite complex. I use a preprocessor (Jamal), so what I edit is .adoc.jam.

I also use Pyama to collects the code snippets and put them into the edited file, so no manual copy-paste, and I still see the preview with the code when I edit the book. I use Omnigraffle, AppleScript to convert to SVG, asciidoctor, and office to get the docx output that Packt requires.

Just FYI.

Thanks.