git.iko.soy/typeable/pandoc
on master help sign in
--self-contained now works with `<video>` as well as `<img>`.
f027fd0John MacFarlane
README+10−10
@@ -265,15 +265,15 @@ Options
265
265
266`--self-contained`
266`--self-contained`
267: Produce a standalone HTML file with no external dependencies, using
267: Produce a standalone HTML file with no external dependencies, using
268− `data:` URIs to incorporate the contents of linked scripts, images,
268+ `data:` URIs to incorporate the contents of linked scripts, stylesheets,
269− and stylesheets. The resulting file should be "self-contained," in the
269+ images, and videos. The resulting file should be "self-contained,"
270− sense that it needs no external files and no net access to be displayed
270+ in the sense that it needs no external files and no net access to be
271− properly by a browser. This option works only with HTML output formats,
271+ displayed properly by a browser. This option works only with HTML output
272− including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`. Scripts,
272+ formats, including `html`, `html+lhs`, `s5`, `slidy`, and `dzslides`.
273− images, and stylesheets at absolute URLs will be downloaded; those at
273+ Scripts, images, and stylesheets at absolute URLs will be downloaded;
274− relative URLs will be sought first relative to the working directory,
274+ those at relative URLs will be sought first relative to the working
275− then relative to the user data directory (see `--data-dir`), and finally
275+ directory, then relative to the user data directory (see `--data-dir`),
276− relative to pandoc's default data directory.
276+ and finally relative to pandoc's default data directory.
277
277
278`--offline`
278`--offline`
279: Deprecated synonym for `--self-contained`.
279: Deprecated synonym for `--self-contained`.
@@ -1960,7 +1960,7 @@ files it does not find in the user data directory.
1960
1960
1961The `--self-contained` option can be used to produce a single file that
1961The `--self-contained` option can be used to produce a single file that
1962contains all of the data necessary to display the slide show, including
1962contains all of the data necessary to display the slide show, including
1963−linked scripts, stylesheets, and images.
1963+linked scripts, stylesheets, images, and videos.
1964
1964
1965Incremental lists
1965Incremental lists
1966-----------------
1966-----------------
src/Text/Pandoc/SelfContained.hs+7
@@ -209,6 +209,13 @@ convertTag userdata t@(TagOpen "img" as) =
209 (raw, mime) <- getRaw userdata t src
209 (raw, mime) <- getRaw userdata t src
210 let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
210 let enc = "data:" ++ mime ++ ";base64," ++ toString (encode raw)
211 return $ TagOpen "img" (("src",enc) : [(x,y) | (x,y) <- as, x /= "src"])
211 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"])
212convertTag userdata t@(TagOpen "script" as) =
219convertTag userdata t@(TagOpen "script" as) =
213 case fromAttrib "src" t of
220 case fromAttrib "src" t of
214 [] -> return t
221 [] -> return t