summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/SelfContained.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-26 22:48:02 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-26 22:48:02 +0100
commit377c27befedd8f9e54975296a71bf4c954399d2d (patch)
tree65fd31def34118e6189d47f78753f629eb946788 /src/Text/Pandoc/SelfContained.hs
parentd7e25d203ac7ff1a18b5d0d6bbffa48d1e033e2c (diff)
`--self-contained`: don't incorporate elements with `data-external="1"`.
You can leave an external link as it is by adding the attribute data-external="1" to the element. Pandoc will then not try to incorporate its content when `--self-contained` is used. This is similar to a feature already supported by the EPUB writer. Closes #2656.
Diffstat (limited to 'src/Text/Pandoc/SelfContained.hs')
-rw-r--r--src/Text/Pandoc/SelfContained.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index e6d859421..378b2fe98 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -69,6 +69,8 @@ makeDataURI (mime, raw) =
convertTags :: PandocMonad m => Maybe String -> [Tag String] -> m [Tag String]
convertTags _ [] = return []
+convertTags sourceURL (t@TagOpen{}:ts)
+ | fromAttrib "data-external" t == "1" = (t:) <$> convertTags sourceURL ts
convertTags sourceURL (t@(TagOpen tagname as):ts)
| tagname `elem`
["img", "embed", "video", "input", "audio", "source", "track"] = do