MediaWiki writer: add display attribute on <math> tags.

This allows display math to be rendered properly.

Closes #3452.
This commit is contained in:
John MacFarlane 2017-02-21 22:57:48 +01:00
parent 5269724ad3
commit e462f80d74
2 changed files with 12 additions and 9 deletions

View file

@ -388,8 +388,11 @@ inlineToMediaWiki (Code _ str) =
inlineToMediaWiki (Str str) = return $ escapeString str inlineToMediaWiki (Str str) = return $ escapeString str
inlineToMediaWiki (Math _ str) = return $ "<math>" ++ str ++ "</math>" inlineToMediaWiki (Math mt str) = return $
-- note: str should NOT be escaped "<math display=\"" ++
(if mt == DisplayMath then "block" else "inline") ++
"\">" ++ str ++ "</math>"
-- note: str should NOT be escaped
inlineToMediaWiki (RawInline f str) inlineToMediaWiki (RawInline f str)
| f == Format "mediawiki" = return str | f == Format "mediawiki" = return str

View file

@ -469,13 +469,13 @@ Ellipses…and…and….
= LaTeX = = LaTeX =
* *
* <math>2+2=4</math> * <math display="inline">2+2=4</math>
* <math>x \in y</math> * <math display="inline">x \in y</math>
* <math>\alpha \wedge \omega</math> * <math display="inline">\alpha \wedge \omega</math>
* <math>223</math> * <math display="inline">223</math>
* <math>p</math>-Tree * <math display="inline">p</math>-Tree
* Heres some display math: <math>\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math> * Heres some display math: <math display="block">\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}</math>
* Heres one that has a line break in it: <math>\alpha + \omega \times x^2</math>. * Heres one that has a line break in it: <math display="inline">\alpha + \omega \times x^2</math>.
These shouldnt be math: These shouldnt be math: