asciidoc-py/asciidoc-py2

Wrong base64 encoding when using data:uri

arnauldvm opened this issue · 7 comments

When using data:uri, some images are not properly displayed (empty, or partial, or scrambled).
(I'm using asciidoc 8.6.4 with Python 2.7.11 under OSX 10.10.5)

Examining the base64 in details, and comparing with a self produced base64, I found out that all instances of the character sequence '+++' is missing in the output of asciidoc.
(I guess because +++ has a special meaning for asciidoc while it should "pass-through".)

This issue had already been described here :
https://groups.google.com/d/topic/asciidoc/pC22vFTCxTc/discussion
(Unfortunately the patch proposed back then is not available anymore.)

I do have a reproducer but the image is 114K big. I may post it wherever you want.
The asciidoc code is:

reproducer.txt

Reproducer
==========
:data-uri:

image:image.png[]

compiled with: $ asciidoc reproducer.txt

I guess somebody will have to re-create the patch (or an equivalent) if nobody has a copy, you could try emailing the OP to see if they still have a copy.

I'd already have done the patch if I was more proficient in Python (one of the few languages I do not practice).
I've asked for the old patch and will create a pull request if I receive something.
Otherwise I guess I'll have to start learning Python :-/
(Unless someone else is motivated enough ?)

I'm having the same problem. I guess we're stuck using block images...

I run into an issue when the base64 encoded image has // in the beginning of the line. Decided to just break the inline comment processing for now to work around it. Adding several more slashes to asciidoc.conf section Inline comment did the trick.

Hi,

The python 2 implementation of asciidoc (which is what this repo is about) is deprecated.
Please move your issue to the python 3 implementation at https://github.com/asciidoc/asciidoc-py3 if still relevant on that newer implementation and close this issue.

Thanks for your help,
Joseph

Testing this, using an image with a variable number of + around the image (including 1, 2, 3, and 4 + in a row), the image inlined as expected.

I could not find an image with a leading // to test, but did find an image with a // in the middle of it and it worked fine.

Could not reproduce on the latest version of AsciiDoc.py, so closing this. If someone hits this problem again, they'll need to open a new issue to track it.