From 3df2f1e3de38d4aa50b3df5e4c6ee7cab8a33312 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 19 Dec 2012 11:29:03 -0800 Subject: EPUB3: Don't use the switch statement for mathml. It is not widely implemented yet. --- src/Text/Pandoc/Writers/EPUB.hs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/Text/Pandoc') diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index f1ae41d2f..e7feace7a 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -168,7 +168,7 @@ writeEPUB version opts doc@(Pandoc meta _) = do ([("id", takeBaseName $ eRelativePath ent), ("href", eRelativePath ent), ("media-type", "application/xhtml+xml")] - ++ [("properties","mathml switch") | epub3 && + ++ [("properties","mathml") | epub3 && containsMathML ent]) $ () let chapterRefNode ent = unode "itemref" ! [("idref", takeBaseName $ eRelativePath ent)] $ () @@ -383,17 +383,12 @@ transformInlines _ sourceDir picsRef (Image lab (src,tit) : xs) = do return new return $ Image lab (newsrc, tit) : xs transformInlines (MathML _) _ _ (x@(Math _ _) : xs) = do + -- note: ideally we'd use a switch statement to provide a fallback + -- but switch does not seem to be widely implemented yet, so we just + -- provide the mathml let writeHtmlInline opts z = trimr $ writeHtmlString opts $ Pandoc (Meta [] [] []) [Plain [z]] - mathml = writeHtmlInline def{writerHTMLMathMethod = MathML Nothing } x - -- we use mathjax to get raw latex, since readers tend to - -- fall back to using mathjax... - fallback = writeHtmlInline def{writerHTMLMathMethod = MathJax "" } x - inSwitch = "" ++ mathml ++ - "" ++ fallback ++ - "" - result = if "