diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-02-15 22:55:17 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-02-15 22:55:17 -0800 |
commit | bc2aca3d6d4f3d59ba0b6a4b2f1e17ed4716e31a (patch) | |
tree | 1a821a804ecea0888fa73f9babdd117adc25b656 /src/Text/Pandoc | |
parent | d7d1c9c8e41851e06c1224ae018f740c915a3600 (diff) | |
download | pandoc-bc2aca3d6d4f3d59ba0b6a4b2f1e17ed4716e31a.tar.gz |
ipynb writer: don't create attachments for images with absolute URIs.
...including data: URIs.
Closes #5303.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/Ipynb.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Ipynb.hs b/src/Text/Pandoc/Writers/Ipynb.hs index a268efa01..38429f790 100644 --- a/src/Text/Pandoc/Writers/Ipynb.hs +++ b/src/Text/Pandoc/Writers/Ipynb.hs @@ -49,7 +49,7 @@ import Data.Text (Text) import qualified Data.Text as T import Data.Aeson as Aeson import qualified Text.Pandoc.UTF8 as UTF8 -import Text.Pandoc.Shared (safeRead) +import Text.Pandoc.Shared (safeRead, isURI) import Text.Pandoc.Writers.Shared (metaToJSON') import Text.Pandoc.Writers.Markdown (writeMarkdown) import qualified Data.Text.Encoding as TE @@ -98,7 +98,8 @@ pandocToNotebook opts (Pandoc meta blocks) = do addAttachment :: PandocMonad m => Inline -> StateT (M.Map Text MimeBundle) m Inline -addAttachment (Image attr lab (src,tit)) = do +addAttachment (Image attr lab (src,tit)) + | not (isURI src) = do (img, mbmt) <- fetchItem src let mt = maybe "application/octet-stream" (T.pack) mbmt modify $ M.insert (T.pack src) |