aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-01-20 14:05:14 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-01-20 14:05:14 -0800
commit6c758434221dd4b717f26290dbb58e5377389f89 (patch)
treea33b1d0bffd6a37031901fd383a81867aff87379
parente3fd1cd108b5cd485c920bf0d1ec1f4ef9a38467 (diff)
downloadpandoc-6c758434221dd4b717f26290dbb58e5377389f89.tar.gz
Docx: Put display math on separate line.
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index f0cb5b477..fb05c18a3 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -537,13 +537,17 @@ inlineToOpenXML opts (Quoted quoteType lst) =
where (open, close) = case quoteType of
SingleQuote -> ("\x2018", "\x2019")
DoubleQuote -> ("\x201C", "\x201D")
-inlineToOpenXML opts (Math t str) =
- case texMathToOMML dt str of
+inlineToOpenXML opts (Math InlineMath str) =
+ case texMathToOMML DisplayInline str of
Right r -> return [r]
Left _ -> inlinesToOpenXML opts (readTeXMath str)
- where dt = if t == InlineMath
- then DisplayInline
- else DisplayBlock
+inlineToOpenXML opts (Math DisplayMath str) =
+ case texMathToOMML DisplayBlock str of
+ Right r -> return [br, r, br]
+ Left _ -> do
+ fallback <- inlinesToOpenXML opts (readTeXMath str)
+ return $ [br] ++ fallback ++ [br]
+ where br = mknode "w:br" [] ()
inlineToOpenXML opts (Cite _ lst) = inlinesToOpenXML opts lst
inlineToOpenXML _ (Code attrs str) =
withTextProp (rStyle "VerbatimChar")