git.iko.soy/typeable/pandoc
on master help sign in
--self-contained now works with `<video>` as well as `<img>`.
commitf027fd0eff899146dd8b69e3e5a6565ca1c4da0b authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 24 Nov 2011, 10:04 (15 years ago) parent41eded5
2 files changed+17−10
README+10−10 src/Text/Pandoc/SelfContained.hs+7
README+10−10
@@ -265,15 +265,15 @@ Options
265265
266266`--self-contained`
267267: Produce a standalone HTML file with no external dependencies, using
268− `data:` URIs to incorporate the contents of linked scripts, images,
269− and stylesheets. The resulting file should be "self-contained," in the
270− sense that it needs no external files and no net access to be displayed
271− properly by a browser. This option works only with HTML output formats,
272− including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`. Scripts,
273− images, and stylesheets at absolute URLs will be downloaded; those at
274− relative URLs will be sought first relative to the working directory,
275− then relative to the user data directory (see `--data-dir`), and finally
276− relative to pandoc's default data directory.
268+ `data:` URIs to incorporate the contents of linked scripts, stylesheets,
269+ images, and videos. The resulting file should be "self-contained,"
270+ in the sense that it needs no external files and no net access to be
271+ displayed properly by a browser. This option works only with HTML output
272+ formats, including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`.
273+ Scripts, images, and stylesheets at absolute URLs will be downloaded;
274+ those at relative URLs will be sought first relative to the working
275+ directory, then relative to the user data directory (see `--data-dir`),
276+ and finally relative to pandoc's default data directory.
277277
278278`--offline`
279279: Deprecated synonym for `--self-contained`.
@@ -1960,7 +1960,7 @@ files it does not find in the user data directory.
19601960
19611961The `--self-contained` option can be used to produce a single file that
19621962contains all of the data necessary to display the slide show, including
1963−linked scripts, stylesheets, and images.
1963+linked scripts, stylesheets, images, and videos.
19641964
19651965Incremental lists
19661966-----------------
src/Text/Pandoc/SelfContained.hs+7
@@ -209,6 +209,13 @@ convertTag userdata t@(TagOpen "img" as) =
209209 (raw, mime) <- getRaw userdata t src
210210 let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
211211 return $ TagOpen "img" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
212+convertTag userdata t@(TagOpen "video" as) =
213+ case fromAttrib "src" t of
214+ [] -> return t
215+ src -> do
216+ (raw, mime) <- getRaw userdata t src
217+ let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
218+ return $ TagOpen "video" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
212219convertTag userdata t@(TagOpen "script" as) =
213220 case fromAttrib "src" t of
214221 [] -> return t