Description: use online LaTeXMathML.js by default Author: Jonas Smedegaard Last-Update: 2017-07-21 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/pandoc.hs +++ b/pandoc.hs @@ -818,8 +818,11 @@ , Option "m" ["latexmathml", "asciimathml"] (OptArg - (\arg opt -> - return opt { optHTMLMathMethod = LaTeXMathML arg }) + (\arg opt -> do + let url' = case arg of + Just u -> u + Nothing -> "http://math.etsu.edu/LaTeXMathML/LaTeXMathML.js" + return opt { optHTMLMathMethod = LaTeXMathML url'}) "URL") "" -- "Use LaTeXMathML script in html output" @@ -1315,12 +1318,6 @@ in throwIO e') else throwIO e) - variables' <- case mathMethod of - LaTeXMathML Nothing -> do - s <- readDataFileUTF8 datadir "LaTeXMathML.js" - return $ ("mathml-script", s) : variables - _ -> return variables - variables'' <- if format == "dzslides" then do dztempl <- readDataFileUTF8 datadir @@ -1329,8 +1326,8 @@ let dzcore = unlines $ dropWhile (not . (dzline `isPrefixOf`)) $ lines dztempl - return $ ("dzslides-core", dzcore) : variables' - else return variables' + return $ ("dzslides-core", dzcore) : variables + else return variables let sourceURL = case sources of [] -> Nothing --- a/src/Text/Pandoc/Options.hs +++ b/src/Text/Pandoc/Options.hs @@ -299,7 +299,7 @@ data EPUBVersion = EPUB2 | EPUB3 deriving (Eq, Show, Read, Data, Typeable, Generic) data HTMLMathMethod = PlainMath - | LaTeXMathML (Maybe String) -- url of LaTeXMathML.js + | LaTeXMathML String -- url of LaTeXMathML.js | JsMath (Maybe String) -- url of jsMath load script | GladTeX | WebTeX String -- url of TeX->image script. --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -142,7 +142,7 @@ let notes = reverse (stNotes st) let thebody = blocks' >> footnoteSection opts notes let math = case writerHTMLMathMethod opts of - LaTeXMathML (Just url) -> + LaTeXMathML url -> H.script ! A.src (toValue url) ! A.type_ "text/javascript" $ mempty --- a/man/pandoc.1 +++ b/man/pandoc.1 @@ -1105,14 +1105,10 @@ .SS Math rendering in HTML .TP .B \f[C]\-m\f[] [\f[I]URL\f[]], \f[C]\-\-latexmathml\f[][\f[C]=\f[]\f[I]URL\f[]] -Use the LaTeXMathML script to display embedded TeX math in HTML output. -To insert a link to a local copy of the \f[C]LaTeXMathML.js\f[] script, -provide a \f[I]URL\f[]. -If no \f[I]URL\f[] is provided, the contents of the script will be -inserted directly into the HTML header, preserving portability at the -price of efficiency. -If you plan to use math on several pages, it is much better to link to a -copy of the script, so it can be cached. +Use LaTeXMathML to display embedded TeX math in HTML output. +The \f[I]URL\f[] should point to the \f[C]LaTeXMathML.js\f[] load script. +If a \f[I]URL\f[] is not provided, a link to LaTeXMathML.js at the +Homepage of LaTeXMathML will be inserted. .RS .RE .TP