Fix regression with tex math environments in HTML + MathJax.
Closes #4639.
This commit is contained in:
parent
81881ce470
commit
d3be567a73
2 changed files with 15 additions and 11 deletions
|
@ -665,16 +665,11 @@ blockToHtml opts (Para [Image attr@(_,classes,_) txt (src,tit)])
|
||||||
-- title beginning with fig: indicates that the image is a figure
|
-- title beginning with fig: indicates that the image is a figure
|
||||||
blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) =
|
blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) =
|
||||||
figure opts attr txt (s,tit)
|
figure opts attr txt (s,tit)
|
||||||
blockToHtml opts (Para lst)
|
blockToHtml opts (Para lst) = do
|
||||||
| isEmptyRaw lst = return mempty
|
contents <- inlineListToHtml opts lst
|
||||||
| null lst && not (isEnabled Ext_empty_paragraphs opts) = return mempty
|
case contents of
|
||||||
| otherwise = do
|
Empty _ | not (isEnabled Ext_empty_paragraphs opts) -> return mempty
|
||||||
contents <- inlineListToHtml opts lst
|
_ -> return $ H.p contents
|
||||||
return $ H.p contents
|
|
||||||
where
|
|
||||||
isEmptyRaw [RawInline f _] = f `notElem` [Format "html",
|
|
||||||
Format "html4", Format "html5"]
|
|
||||||
isEmptyRaw _ = False
|
|
||||||
blockToHtml opts (LineBlock lns) =
|
blockToHtml opts (LineBlock lns) =
|
||||||
if writerWrapText opts == WrapNone
|
if writerWrapText opts == WrapNone
|
||||||
then blockToHtml opts $ linesToPara lns
|
then blockToHtml opts $ linesToPara lns
|
||||||
|
@ -1063,7 +1058,6 @@ inlineToHtml opts inline = do
|
||||||
if ishtml
|
if ishtml
|
||||||
then return $ preEscapedString str
|
then return $ preEscapedString str
|
||||||
else if (f == Format "latex" || f == Format "tex") &&
|
else if (f == Format "latex" || f == Format "tex") &&
|
||||||
"\\begin" `isPrefixOf` str &&
|
|
||||||
allowsMathEnvironments (writerHTMLMathMethod opts) &&
|
allowsMathEnvironments (writerHTMLMathMethod opts) &&
|
||||||
isMathEnvironment str
|
isMathEnvironment str
|
||||||
then inlineToHtml opts $ Math DisplayMath str
|
then inlineToHtml opts $ Math DisplayMath str
|
||||||
|
|
10
test/command/4639.md
Normal file
10
test/command/4639.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
```
|
||||||
|
% pandoc -t html --mathjax
|
||||||
|
\begin{equation}
|
||||||
|
E=mc^2
|
||||||
|
\end{equation}
|
||||||
|
^D
|
||||||
|
<p><span class="math display">\[\begin{equation}
|
||||||
|
E=mc^2
|
||||||
|
\end{equation}\]</span></p>
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue