@@ -401,15 +401,21 @@ writeEPUB opts doc@(Pandoc meta _) = do
401401 let chapterEntries = zipWith chapToEntry [1..] chapters
402402
403403 -- incredibly inefficient (TODO):
404− let containsMathML ent = "<math" `isInfixOf` (B8.unpack $ fromEntry ent)
404+ let containsMathML ent = epub3 &&
405+ "<math" `isInfixOf` (B8.unpack $ fromEntry ent)
406+ let containsSVG ent = epub3 &&
407+ "<svg" `isInfixOf` (B8.unpack $ fromEntry ent)
408+ let props ent = ["mathml" | containsMathML ent] ++ ["svg" | containsSVG ent]
405409
406410 -- contents.opf
407411 let chapterNode ent = unode "item" !
408412 ([("id", takeBaseName $ eRelativePath ent),
409413 ("href", eRelativePath ent),
410414 ("media-type", "application/xhtml+xml")]
411− ++ [("properties","mathml") | epub3 &&
412− containsMathML ent]) $ ()
415+ ++ case props ent of
416+ [] -> []
417+ xs -> [("properties", unwords xs)])
418+ $ ()
413419 let chapterRefNode ent = unode "itemref" !
414420 [("idref", takeBaseName $ eRelativePath ent)] $ ()
415421 let pictureNode ent = unode "item" !