aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-09-23 08:49:52 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-09-23 08:49:52 -0700
commitf0a6eb913d7ace9de720539efb8984ea00ac82db (patch)
treee3e86c17df0ce1b90fe95bf9ab2163caf48089ef /src/Text/Pandoc
parent0afb48cd384ea1663f88bda32d0d149dc9a6f6c5 (diff)
downloadpandoc-f0a6eb913d7ace9de720539efb8984ea00ac82db.tar.gz
HTML writer: render `\ref` and `\eqref` as inline math...
not display. See #7589.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs19
1 files changed, 11 insertions, 8 deletions
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