aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/EPUB.hs
diff options
context:
space:
mode:
authorMichael Hoffmann <brennan.brisad@gmail.com>2021-07-07 18:26:37 +0200
committerGitHub <noreply@github.com>2021-07-07 09:26:37 -0700
commit565330033a623ed7bf4d0a3b57dd14710cf27703 (patch)
tree329f0def2db3ed68bfad0e62e4c398884df4e6ec /src/Text/Pandoc/Writers/EPUB.hs
parente56e2b0e0be9256ddef798d28f5d2af6e756508d (diff)
downloadpandoc-565330033a623ed7bf4d0a3b57dd14710cf27703.tar.gz
Don't incorporate externally linked images in EPUB documents (#7430)
Just like it is possible to avoid incorporating an image in EPUB by passing `data-external="1"` to a raw HTML snippet, this makes the same possible for native Images, by looking for an associated `external` attribute.
Diffstat (limited to 'src/Text/Pandoc/Writers/EPUB.hs')
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index 3c092a2c1..508fb6a98 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -1131,7 +1131,8 @@ transformInline :: PandocMonad m
=> WriterOptions
-> Inline
-> E m Inline
-transformInline _opts (Image attr lab (src,tit)) = do
+transformInline _opts (Image attr@(_,_,kvs) lab (src,tit))
+ | isNothing (lookup "external" kvs) = do
newsrc <- modifyMediaRef $ T.unpack src
return $ Image attr lab ("../" <> newsrc, tit)
transformInline opts x@(Math t m)