HTML writer: harmless code simplification.

Since the 'math' is only put into the template if stMath is
set anyway, there's no need for this conditional.
This commit is contained in:
John MacFarlane 2016-01-14 10:55:04 -08:00
parent 20c55ab110
commit f2c0974a26

View file

@ -140,40 +140,38 @@ pandocToHtml opts (Pandoc meta blocks) = do
st <- get st <- get
let notes = reverse (stNotes st) let notes = reverse (stNotes st)
let thebody = blocks' >> footnoteSection opts notes let thebody = blocks' >> footnoteSection opts notes
let math = if stMath st let math = case writerHTMLMathMethod opts of
then case writerHTMLMathMethod opts of LaTeXMathML (Just url) ->
LaTeXMathML (Just url) -> H.script ! A.src (toValue url)
H.script ! A.src (toValue url) ! A.type_ "text/javascript"
! A.type_ "text/javascript" $ mempty
$ mempty MathML (Just url) ->
MathML (Just url) -> H.script ! A.src (toValue url)
H.script ! A.src (toValue url) ! A.type_ "text/javascript"
! A.type_ "text/javascript" $ mempty
$ mempty MathJax url ->
MathJax url -> H.script ! A.src (toValue url)
H.script ! A.src (toValue url) ! A.type_ "text/javascript"
! A.type_ "text/javascript" $ case writerSlideVariant opts of
$ case writerSlideVariant opts of SlideousSlides ->
SlideousSlides -> preEscapedString
preEscapedString "MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);"
"MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);" _ -> mempty
_ -> mempty JsMath (Just url) ->
JsMath (Just url) -> H.script ! A.src (toValue url)
H.script ! A.src (toValue url) ! A.type_ "text/javascript"
! A.type_ "text/javascript" $ mempty
$ mempty KaTeX js css ->
KaTeX js css -> (H.script ! A.src (toValue js) $ mempty) <>
(H.script ! A.src (toValue js) $ mempty) <> (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
(H.link ! A.rel "stylesheet" ! A.href (toValue css)) <> (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
(H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX) _ -> case lookup "mathml-script" (writerVariables opts) of
_ -> case lookup "mathml-script" (writerVariables opts) of Just s | not (writerHtml5 opts) ->
Just s | not (writerHtml5 opts) -> H.script ! A.type_ "text/javascript"
H.script ! A.type_ "text/javascript" $ preEscapedString
$ preEscapedString ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n")
("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n") | otherwise -> mempty
| otherwise -> mempty Nothing -> mempty
Nothing -> mempty
else mempty
let context = (if stHighlighting st let context = (if stHighlighting st
then defField "highlighting-css" then defField "highlighting-css"
(styleToCss $ writerHighlightStyle opts) (styleToCss $ writerHighlightStyle opts)