git.iko.soy/typeable/pandoc
on master help sign in
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.

commitf2c0974a26b7de7d39168268de7c6257f14c56be authorJohn MacFarlane <jgm@berkeley.edu> dateThu 14 Jan 2016, 10:55 (11 years ago) parent20c55ab
1 file changed+32−34
src/Text/Pandoc/Writers/HTML.hs+32−34
src/Text/Pandoc/Writers/HTML.hs+32−34
@@ -140,40 +140,38 @@ pandocToHtml opts (Pandoc meta blocks) = do
140140 st <- get
141141 let notes = reverse (stNotes st)
142142 let thebody = blocks' >> footnoteSection opts notes
143− let math = if stMath st
144− then case writerHTMLMathMethod opts of
145− LaTeXMathML (Just url) ->
146− H.script ! A.src (toValue url)
147− ! A.type_ "text/javascript"
148− $ mempty
149− MathML (Just url) ->
150− H.script ! A.src (toValue url)
151− ! A.type_ "text/javascript"
152− $ mempty
153− MathJax url ->
154− H.script ! A.src (toValue url)
155− ! A.type_ "text/javascript"
156− $ case writerSlideVariant opts of
157− SlideousSlides ->
158− preEscapedString
159− "MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);"
160− _ -> mempty
161− JsMath (Just url) ->
162− H.script ! A.src (toValue url)
163− ! A.type_ "text/javascript"
164− $ mempty
165− KaTeX js css ->
166− (H.script ! A.src (toValue js) $ mempty) <>
167− (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
168− (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
169− _ -> case lookup "mathml-script" (writerVariables opts) of
170− Just s | not (writerHtml5 opts) ->
171− H.script ! A.type_ "text/javascript"
172− $ preEscapedString
173− ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n")
174− | otherwise -> mempty
175− Nothing -> mempty
176− else mempty
143+ let math = case writerHTMLMathMethod opts of
144+ LaTeXMathML (Just url) ->
145+ H.script ! A.src (toValue url)
146+ ! A.type_ "text/javascript"
147+ $ mempty
148+ MathML (Just url) ->
149+ H.script ! A.src (toValue url)
150+ ! A.type_ "text/javascript"
151+ $ mempty
152+ MathJax url ->
153+ H.script ! A.src (toValue url)
154+ ! A.type_ "text/javascript"
155+ $ case writerSlideVariant opts of
156+ SlideousSlides ->
157+ preEscapedString
158+ "MathJax.Hub.Queue([\"Typeset\",MathJax.Hub]);"
159+ _ -> mempty
160+ JsMath (Just url) ->
161+ H.script ! A.src (toValue url)
162+ ! A.type_ "text/javascript"
163+ $ mempty
164+ KaTeX js css ->
165+ (H.script ! A.src (toValue js) $ mempty) <>
166+ (H.link ! A.rel "stylesheet" ! A.href (toValue css)) <>
167+ (H.script ! A.type_ "text/javascript" $ toHtml renderKaTeX)
168+ _ -> case lookup "mathml-script" (writerVariables opts) of
169+ Just s | not (writerHtml5 opts) ->
170+ H.script ! A.type_ "text/javascript"
171+ $ preEscapedString
172+ ("/*<![CDATA[*/\n" ++ s ++ "/*]]>*/\n")
173+ | otherwise -> mempty
174+ Nothing -> mempty
177175 let context = (if stHighlighting st
178176 then defField "highlighting-css"
179177 (styleToCss $ writerHighlightStyle opts)