summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-03-30 22:09:24 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-03-30 22:11:00 -0700
commit72020f17738e5fd3c47d479a80a2de698980e4c6 (patch)
tree1e28c8f97d0df7f828f96720686a11a45b52fe0d /src/Text/Pandoc/Writers
parent5aec167e71b3da98a0f209e3c75af019682ad354 (diff)
Docx writer: Use Compact style for Plain block elements.
This differentiates between tight and loose lists. Closes #775.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 0549772af..50e39a2a7 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -418,7 +418,8 @@ blockToOpenXML opts (Header lev (ident,_,_) lst) = do
,("w:name",bookmarkName)] ()
let bookmarkEnd = mknode "w:bookmarkEnd" [("w:id", id')] ()
return $ [bookmarkStart] ++ contents ++ [bookmarkEnd]
-blockToOpenXML opts (Plain lst) = blockToOpenXML opts (Para lst)
+blockToOpenXML opts (Plain lst) = withParaProp (pStyle "Compact")
+ $ blockToOpenXML opts (Para lst)
-- title beginning with fig: indicates that the image is a figure
blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
paraProps <- getParaProps False
@@ -781,7 +782,12 @@ stripLeadingTrailingSpace = go . reverse . go . reverse
go xs = xs
fixDisplayMath :: Block -> [Block]
-fixDisplayMath (Plain lst) = fixDisplayMath (Para lst)
+fixDisplayMath (Plain lst)
+ | any isDisplayMath lst && not (all isDisplayMath lst) =
+ -- chop into several paragraphs so each displaymath is its own
+ map (Plain . stripLeadingTrailingSpace) $
+ groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
+ not (isDisplayMath x || isDisplayMath y)) lst
fixDisplayMath (Para lst)
| any isDisplayMath lst && not (all isDisplayMath lst) =
-- chop into several paragraphs so each displaymath is its own