diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-11-30 20:20:18 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-11-30 20:20:18 -0800 |
commit | 0e158d8d8dc277f19d1f7d2686c2672f08410f82 (patch) | |
tree | 8a9a773eabf95f7a71641faaf247aef5223f9d9f /src/Text/Pandoc/Writers | |
parent | a7067ab22b0ce297ccc5271fca59b9f9e787195e (diff) | |
download | pandoc-0e158d8d8dc277f19d1f7d2686c2672f08410f82.tar.gz |
EPUB writer: Insert "svg" property as needed in opf (EPUB 3).
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/EPUB.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index 7be7eb368..b23f43a6e 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -401,15 +401,21 @@ writeEPUB opts doc@(Pandoc meta _) = do let chapterEntries = zipWith chapToEntry [1..] chapters -- 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 let chapterNode ent = unode "item" ! ([("id", takeBaseName $ eRelativePath ent), ("href", eRelativePath ent), ("media-type", "application/xhtml+xml")] - ++ [("properties","mathml") | epub3 && - containsMathML ent]) $ () + ++ case props ent of + [] -> [] + xs -> [("properties", unwords xs)]) + $ () let chapterRefNode ent = unode "itemref" ! [("idref", takeBaseName $ eRelativePath ent)] $ () let pictureNode ent = unode "item" ! |