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?

4

1 回答 1

0

问题是属性data-src。在这种特殊情况下,它与 具有相似的含义src,但这只是因为 HTML 文件使用了一个 JavaScript 库(reveal.js – HTML 演示框架),该库将该属性解释为类似于标准src属性。

但是链接嵌入工具(这里是内联)不知道这一点!所以解决方案是替换data-srcsrc. 这可以通过例如sed脚本来完成。然后内联正确地转换文件。

于 2019-01-23T02:35:45.390 回答