aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-11-24 10:04:25 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-11-24 10:04:25 -0800
commitf027fd0eff899146dd8b69e3e5a6565ca1c4da0b (patch)
tree67a38d9a13153e9462e4fe6b4f5fec2ed23fc4a6
parent41eded5dd2bbf7595281520d590463d71f191635 (diff)
downloadpandoc-f027fd0eff899146dd8b69e3e5a6565ca1c4da0b.tar.gz
--self-contained now works with `<video>` as well as `<img>`.
-rw-r--r--README20
-rw-r--r--src/Text/Pandoc/SelfContained.hs7
2 files changed, 17 insertions, 10 deletions
diff --git a/README b/README
index 4a6f4aaf3..fe667c6d6 100644
--- a/README
+++ b/README
@@ -265,15 +265,15 @@ Options
`--self-contained`
: Produce a standalone HTML file with no external dependencies, using
- `data:` URIs to incorporate the contents of linked scripts, images,
- and stylesheets. The resulting file should be "self-contained," in the
- sense that it needs no external files and no net access to be displayed
- properly by a browser. This option works only with HTML output formats,
- including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`. Scripts,
- images, and stylesheets at absolute URLs will be downloaded; those at
- relative URLs will be sought first relative to the working directory,
- then relative to the user data directory (see `--data-dir`), and finally
- relative to pandoc's default data directory.
+ `data:` URIs to incorporate the contents of linked scripts, stylesheets,
+ images, and videos. The resulting file should be "self-contained,"
+ in the sense that it needs no external files and no net access to be
+ displayed properly by a browser. This option works only with HTML output
+ formats, including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`.
+ Scripts, images, and stylesheets at absolute URLs will be downloaded;
+ those at relative URLs will be sought first relative to the working
+ directory, then relative to the user data directory (see `--data-dir`),
+ and finally relative to pandoc's default data directory.
`--offline`
: Deprecated synonym for `--self-contained`.
@@ -1960,7 +1960,7 @@ files it does not find in the user data directory.
The `--self-contained` option can be used to produce a single file that
contains all of the data necessary to display the slide show, including
-linked scripts, stylesheets, and images.
+linked scripts, stylesheets, images, and videos.
Incremental lists
-----------------
diff --git a/src/Text/Pandoc/SelfContained.hs b/src/Text/Pandoc/SelfContained.hs
index 116083fba..1bc081e0e 100644
--- a/src/Text/Pandoc/SelfContained.hs
+++ b/src/Text/Pandoc/SelfContained.hs
@@ -209,6 +209,13 @@ convertTag userdata t@(TagOpen "img" as) =
(raw, mime) <- getRaw userdata t src
let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
return $ TagOpen "img" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
+convertTag userdata t@(TagOpen "video" as) =
+ case fromAttrib "src" t of
+ [] -> return t
+ src -> do
+ (raw, mime) <- getRaw userdata t src
+ let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
+ return $ TagOpen "video" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
convertTag userdata t@(TagOpen "script" as) =
case fromAttrib "src" t of
[] -> return t