1

I am looking for a working way to automatically embed all local external images (i.e. images on the local file system) which are referenced in the HTML file like

<img data-src="img/my_image.png" />

Obviously this will probably involve the data keyword in HTML. Regarding this problem I have read this SO answer and I tried the suggested tool inliner, but the tool seems to have trouble with external local resources like above.

Are there other proven ways/tools for this job which do handle above mentioned case, preferable currently maintained and maybe even in Python?

halloleo
  • 9,216
  • 13
  • 64
  • 122

1 Answers1

0

The problem is the attribute data-src. It has in this particular situation a similar meaning to src, but only because the HTML file uses a JavaScript library (reveal.js – The HTML Presentation Framework) which interprets this attribute similar to the standard src attribute.

However the link embedding tool (inliner here) does not know about this! So the solution is to replace data-src with src. This can be done e.g. with a sed script. Then inliner converts the file correctly.

halloleo
  • 9,216
  • 13
  • 64
  • 122