asciidoc-py / asciidoc-py2

Deprecated python2 implementation of AsciiDoc.py. See asciidoc-py/asciidoc-py for current work.
https://asciidoc.org/
GNU General Public License v2.0
466 stars 128 forks source link

Wrong base64 encoding when using data:uri #98

Closed arnauldvm closed 3 years ago

arnauldvm commented 8 years ago

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

elextr commented 8 years ago

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.

arnauldvm commented 8 years ago

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 ?)

El-Servas commented 8 years ago

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

kallepokki commented 8 years ago

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.

aerostitch commented 5 years ago

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

MasterOdin commented 4 years ago

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.

MasterOdin commented 3 years ago

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.