EPUB writer: Insert "svg" property as needed in opf (EPUB 3).
This commit is contained in:
parent
a7067ab22b
commit
0e158d8d8d
1 changed files with 9 additions and 3 deletions
|
@ -401,15 +401,21 @@ writeEPUB opts doc@(Pandoc meta _) = do
|
||||||
let chapterEntries = zipWith chapToEntry [1..] chapters
|
let chapterEntries = zipWith chapToEntry [1..] chapters
|
||||||
|
|
||||||
-- incredibly inefficient (TODO):
|
-- incredibly inefficient (TODO):
|
||||||
let containsMathML ent = "<math" `isInfixOf` (B8.unpack $ fromEntry ent)
|
let containsMathML ent = epub3 &&
|
||||||
|
"<math" `isInfixOf` (B8.unpack $ fromEntry ent)
|
||||||
|
let containsSVG ent = epub3 &&
|
||||||
|
"<svg" `isInfixOf` (B8.unpack $ fromEntry ent)
|
||||||
|
let props ent = ["mathml" | containsMathML ent] ++ ["svg" | containsSVG ent]
|
||||||
|
|
||||||
-- contents.opf
|
-- contents.opf
|
||||||
let chapterNode ent = unode "item" !
|
let chapterNode ent = unode "item" !
|
||||||
([("id", takeBaseName $ eRelativePath ent),
|
([("id", takeBaseName $ eRelativePath ent),
|
||||||
("href", eRelativePath ent),
|
("href", eRelativePath ent),
|
||||||
("media-type", "application/xhtml+xml")]
|
("media-type", "application/xhtml+xml")]
|
||||||
++ [("properties","mathml") | epub3 &&
|
++ case props ent of
|
||||||
containsMathML ent]) $ ()
|
[] -> []
|
||||||
|
xs -> [("properties", unwords xs)])
|
||||||
|
$ ()
|
||||||
let chapterRefNode ent = unode "itemref" !
|
let chapterRefNode ent = unode "itemref" !
|
||||||
[("idref", takeBaseName $ eRelativePath ent)] $ ()
|
[("idref", takeBaseName $ eRelativePath ent)] $ ()
|
||||||
let pictureNode ent = unode "item" !
|
let pictureNode ent = unode "item" !
|
||||||
|
|
Loading…
Reference in a new issue