From 7018003811f2b606808ddecb5c1ce12e27ad7d51 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 30 Jan 2017 11:31:50 +0100 Subject: [PATCH] `--mathml` and MathML in HTMLMathMethod longer take an argument. The argument was for a bridge javascript that used to be necessary in 2004. We have removed the script already. --- MANUAL.txt | 7 ++----- pandoc.hs | 10 +++------- src/Text/Pandoc/Options.hs | 2 +- src/Text/Pandoc/Writers/Docbook.hs | 8 ++++---- src/Text/Pandoc/Writers/EPUB.hs | 2 +- src/Text/Pandoc/Writers/HTML.hs | 8 ++------ src/Text/Pandoc/Writers/TEI.hs | 4 ++-- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index c773f2336..3e4425a72 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -945,13 +945,10 @@ Math rendering in HTML several pages, it is much better to link to a copy of the script, so it can be cached. -`--mathml`[`=`*URL*] +`--mathml` : Convert TeX math to [MathML] (in `docbook4`, `docbook5`, - `html4` and `html5`). In standalone HTML output, a small - JavaScript (or a link to such a script if a *URL* is - supplied) will be inserted that allows the MathML to be - viewed on some browsers. + `html4` and `html5`). `--jsmath`[`=`*URL*] diff --git a/pandoc.hs b/pandoc.hs index a5163dae5..c30507021 100644 --- a/pandoc.hs +++ b/pandoc.hs @@ -256,9 +256,6 @@ convertWithOpts opts args = do LaTeXMathML Nothing -> do s <- readDataFileUTF8 datadir "LaTeXMathML.js" return $ ("mathml-script", s) : variables - MathML Nothing -> do - s <- readDataFileUTF8 datadir "MathMLinHTML.js" - return $ ("mathml-script", s) : variables _ -> return variables variables'' <- if format == "dzslides" @@ -1110,10 +1107,9 @@ options = "" -- "Use LaTeXMathML script in html output" , Option "" ["mathml"] - (OptArg - (\arg opt -> - return opt { optHTMLMathMethod = MathML arg }) - "URL") + (NoArg + (\opt -> + return opt { optHTMLMathMethod = MathML })) "" -- "Use mathml for HTML math" , Option "" ["mimetex"] diff --git a/src/Text/Pandoc/Options.hs b/src/Text/Pandoc/Options.hs index 02ae9f771..c00981d5d 100644 --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -89,7 +89,7 @@ data HTMLMathMethod = PlainMath | JsMath (Maybe String) -- url of jsMath load script | GladTeX | WebTeX String -- url of TeX->image script. - | MathML (Maybe String) -- url of MathMLinHTML.js + | MathML | MathJax String -- url of MathJax.js | KaTeX String String -- url of stylesheet and katex.js deriving (Show, Read, Eq, Data, Typeable, Generic) diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 53618d173..4c5b255d8 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -117,8 +117,8 @@ writeDocbook opts (Pandoc meta blocks) = do main <- (render' . vcat) <$> (mapM (elementToDocbook opts' startLvl) elements) let context = defField "body" main $ defField "mathml" (case writerHTMLMathMethod opts of - MathML _ -> True - _ -> False) + MathML -> True + _ -> False) $ metadata return $ case writerTemplate opts of Nothing -> main @@ -421,8 +421,8 @@ inlineToDocbook opts (Note contents) = inTagsIndented "footnote" <$> blocksToDocbook opts contents isMathML :: HTMLMathMethod -> Bool -isMathML (MathML _) = True -isMathML _ = False +isMathML MathML = True +isMathML _ = False idAndRole :: Attr -> [(String, String)] idAndRole (id',cls,_) = ident ++ role diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs index ae77c10a2..d21f7bea1 100644 --- a/src/Text/Pandoc/Writers/EPUB.hs +++ b/src/Text/Pandoc/Writers/EPUB.hs @@ -382,7 +382,7 @@ pandocToEPUB version opts doc@(Pandoc meta _) = do , writerVariables = vars , writerHTMLMathMethod = if epub3 - then MathML Nothing + then MathML else writerHTMLMathMethod opts , writerWrapText = WrapAuto } metadata <- getEPUBMetadata opts' meta diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 9037bfbec..d1fb3dda7 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -230,10 +230,6 @@ pandocToHtml opts (Pandoc meta blocks) = do H.script ! A.src (toValue url) ! A.type_ "text/javascript" $ mempty - MathML (Just url) -> - H.script ! A.src (toValue url) - ! A.type_ "text/javascript" - $ mempty MathJax url -> H.script ! A.src (toValue url) ! A.type_ "text/javascript" @@ -903,7 +899,7 @@ inlineToHtml opts inline = do return $ case t of InlineMath -> preEscapedString $ "" ++ str ++ "" DisplayMath -> preEscapedString $ "" ++ str ++ "" - MathML _ -> do + MathML -> do let conf = useShortEmptyTags (const False) defaultConfigPP res <- lift $ convertMath writeMathML t str @@ -1061,6 +1057,6 @@ isMathEnvironment s = "\\begin{" `isPrefixOf` s && allowsMathEnvironments :: HTMLMathMethod -> Bool allowsMathEnvironments (MathJax _) = True -allowsMathEnvironments (MathML _) = True +allowsMathEnvironments (MathML) = True allowsMathEnvironments (WebTeX _) = True allowsMathEnvironments _ = False diff --git a/src/Text/Pandoc/Writers/TEI.hs b/src/Text/Pandoc/Writers/TEI.hs index c589c0c36..a54d42c53 100644 --- a/src/Text/Pandoc/Writers/TEI.hs +++ b/src/Text/Pandoc/Writers/TEI.hs @@ -76,8 +76,8 @@ writeTEI opts (Pandoc meta blocks) = return $ main = render' $ vcat (map (elementToTEI opts startLvl) elements) context = defField "body" main $ defField "mathml" (case writerHTMLMathMethod opts of - MathML _ -> True - _ -> False) + MathML -> True + _ -> False) $ metadata in case writerTemplate opts of Nothing -> main