From f0a6eb913d7ace9de720539efb8984ea00ac82db Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 23 Sep 2021 08:49:52 -0700 Subject: HTML writer: render `\ref` and `\eqref` as inline math... not display. See #7589. --- src/Text/Pandoc/Writers/HTML.hs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index f883bd6d8..8fc81ed24 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -1468,14 +1468,17 @@ inlineToHtml opts inline = do ishtml <- isRawHtml f if ishtml then return $ preEscapedText str - else if (f == Format "latex" || f == Format "tex") && - ((allowsMathEnvironments (writerHTMLMathMethod opts) && - isMathEnvironment str) || - (allowsRef (writerHTMLMathMethod opts) && isRef str)) - then inlineToHtml opts $ Math DisplayMath str - else do - report $ InlineNotRendered inline - return mempty + else do + let istex = f == Format "latex" || f == Format "tex" + let mm = writerHTMLMathMethod opts + case istex of + True + | allowsMathEnvironments mm && isMathEnvironment str + -> inlineToHtml opts $ Math DisplayMath str + | allowsRef mm && isRef str + -> inlineToHtml opts $ Math InlineMath str + _ -> do report $ InlineNotRendered inline + return mempty (Link attr txt (s,_)) | "mailto:" `T.isPrefixOf` s -> do linkText <- inlineListToHtml opts txt obfuscateLink opts attr linkText s -- cgit v1.2.3