EPUB writer: don't download linked media when data-external
attribute set.
By default pandoc downloads all linked media and includes it in the EPUB container. This can be disabled by setting `data-external` on the tags linking to media that should not be downloaded. Example: <audio controls="1"> <source src="http://www.sixbarsjail.it/tmp/bach_toccata.mp3" type="audio/mpeg"></source> </audio> Closes #2473.
This commit is contained in:
parent
83b1aa042d
commit
c80c0df1fe
2 changed files with 20 additions and 2 deletions
19
README
19
README
|
@ -3489,8 +3489,11 @@ the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
|
||||||
`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
|
`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
|
||||||
`shrink`.
|
`shrink`.
|
||||||
|
|
||||||
|
Creating EPUBs with pandoc
|
||||||
|
==========================
|
||||||
|
|
||||||
EPUB Metadata
|
EPUB Metadata
|
||||||
=============
|
-------------
|
||||||
|
|
||||||
EPUB metadata may be specified using the `--epub-metadata` option, but
|
EPUB metadata may be specified using the `--epub-metadata` option, but
|
||||||
if the source document is markdown, it is better to use a [YAML metadata
|
if the source document is markdown, it is better to use a [YAML metadata
|
||||||
|
@ -3580,6 +3583,20 @@ The following fields are recognized:
|
||||||
[MARC relators]: http://loc.gov/marc/relators/relaterm.html
|
[MARC relators]: http://loc.gov/marc/relators/relaterm.html
|
||||||
[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
|
[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
|
||||||
|
|
||||||
|
Linked media
|
||||||
|
------------
|
||||||
|
|
||||||
|
By default, pandoc will download linked media (including audio and
|
||||||
|
video) and include it in the EPUB container, yielding a completely
|
||||||
|
self-contained EPUB. If you want to link to external media resources
|
||||||
|
instead, use raw HTML in your source and add `data-external="1"` to the tag
|
||||||
|
with the `src` attribute. For example:
|
||||||
|
|
||||||
|
<audio controls="1">
|
||||||
|
<source src="http://www.sixbarsjail.it/tmp/bach_toccata.mp3"
|
||||||
|
data-external="1" type="audio/mpeg"></source>
|
||||||
|
</audio>
|
||||||
|
|
||||||
Literate Haskell support
|
Literate Haskell support
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
|
@ -816,7 +816,8 @@ transformTag :: WriterOptions
|
||||||
-> Tag String
|
-> Tag String
|
||||||
-> IO (Tag String)
|
-> IO (Tag String)
|
||||||
transformTag opts mediaRef tag@(TagOpen name attr)
|
transformTag opts mediaRef tag@(TagOpen name attr)
|
||||||
| name `elem` ["video", "source", "img", "audio"] = do
|
| name `elem` ["video", "source", "img", "audio"] &&
|
||||||
|
lookup "data-external" attr == Nothing = do
|
||||||
let src = fromAttrib "src" tag
|
let src = fromAttrib "src" tag
|
||||||
let poster = fromAttrib "poster" tag
|
let poster = fromAttrib "poster" tag
|
||||||
newsrc <- modifyMediaRef opts mediaRef src
|
newsrc <- modifyMediaRef opts mediaRef src
|
||||||
|
|
Loading…
Reference in a new issue