wshito / asciidoctor-chunker

The utility to create chunked HTML files from the single HTML generated by Asciidoctor.
MIT License
25 stars 7 forks source link

False-Positive Warnings for Data-URI Embedded Images #23

Closed tajmone closed 2 years ago

tajmone commented 2 years ago

I've noticed that after successfully chunking a book that uses Data URI embedded images asciidoctor-chunker reports an error (warning?) for each image:

 Local file linked from the document is missing: data:image\svg+xml;base64,[etc.]

But the images are working fine, so it seems just that asciidoctor-chunker is trying to track the presence of external images (to copy them in the output folder?) not realizing they are Data URI encoded.

This should be fairly simple to fix, since embedded images always start with data:. E.g.

<img src="data:image/svg+xml;base64,

So wherever asciidoctor-chunker is inspecting images paths, it should skip when data: is encountered.

(I would have loved to contribute this fix myself, but I'm not really into JavaScript, so it unlikely I could come up with an idiomatic solution)

wshito commented 2 years ago

Oops! I totally forgot about the case for the data URL. I will fix this in the next release. Thank you for pointing out.

wshito commented 2 years ago

@tajmone I have fixed the bug for handling the data URLs. Could you pull the repository and check with the dist/asciidoctor-chunker.js script please?

tajmone commented 2 years ago

Could you pull the repository and check with the dist/asciidoctor-chunker.js script please?

Tested, it works fine: no warnings and all embedded images are working (tested with SVG and PNG).

Also, the -V switch now returns the correct versions number (1.0.5 instead of dev).

Thanks!