The Wayback Machine - https://web.archive.org/web/20201021105330/https://github.com/jgm/pandoc/issues/6543
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect data-external="1" attribute also for native images #6543

Open
csos95 opened this issue Jul 17, 2020 · 2 comments · May be fixed by #6759
Open

Respect data-external="1" attribute also for native images #6543

csos95 opened this issue Jul 17, 2020 · 2 comments · May be fixed by #6759

Comments

@csos95
Copy link

@csos95 csos95 commented Jul 17, 2020

Version: 2.9.2.1

Input

<html>
<head>
	<title>placeholder</title>
</head>
<body>
	<img data-external="1" src="https://static.fimfiction.net/images/logo-2x.png">
</body>
</html>

Output

> pandoc -f html -t epub -o test.epub test.html
> unzip -l test.epub 
Archive:  test.epub
  Length      Date    Time    Name
---------  ---------- -----   ----
       20  2020-07-17 22:35   mimetype
      251  2020-07-17 22:35   META-INF/container.xml
      160  2020-07-17 22:35   META-INF/com.apple.ibooks.display-options.xml
     1400  2020-07-17 22:35   EPUB/content.opf
      767  2020-07-17 22:35   EPUB/toc.ncx
      541  2020-07-17 22:35   EPUB/nav.xhtml
      496  2020-07-17 22:35   EPUB/text/title_page.xhtml
      914  2020-07-17 22:35   EPUB/styles/stylesheet1.css
    10638  2020-07-17 22:35   EPUB/media/file0.png <----------- logo-2x.png
      564  2020-07-17 22:35   EPUB/text/ch001.xhtml
---------                     -------
    15751                     10 files
@jgm
Copy link
Owner

@jgm jgm commented Jul 18, 2020

The basic problem is that the <img> element is being parsed as a native pandoc Image, rather than as raw HTML. The data-external trick only works on raw HTML, according to the documentation for EPUBs. Actually, I don't know why that limitation is there. Removing it would probably be a good idea.

@mb21
Copy link
Collaborator

@mb21 mb21 commented Jul 18, 2020

The data-external trick only works on raw HTML, according to the documentation for EPUBs. Actually, I don't know why that limitation is there.

Probably because it was first implemented for audio and video... but indeed, we should just remove that limitation.

@mb21 mb21 changed the title Images get embedded even with data-external="1" Respect data-external="1" attribute also for native images Jul 18, 2020
brisad added a commit to brisad/pandoc that referenced this issue Oct 18, 2020
Just like the data-external attribute can be added to some raw HTML
elements in order to not bundle referenced media in EPUB containers,
this adds the same feature to the ordinary HTML input format for the
<img> element.

Fixes jgm#6543
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.