diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-03-30 22:09:24 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-03-30 22:11:00 -0700 |
commit | 72020f17738e5fd3c47d479a80a2de698980e4c6 (patch) | |
tree | 1e28c8f97d0df7f828f96720686a11a45b52fe0d /src/Text/Pandoc | |
parent | 5aec167e71b3da98a0f209e3c75af019682ad354 (diff) | |
download | pandoc-72020f17738e5fd3c47d479a80a2de698980e4c6.tar.gz |
Docx writer: Use Compact style for Plain block elements.
This differentiates between tight and loose lists.
Closes #775.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 10 |
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 |