aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--data/reference.docxbin9757 -> 9782 bytes
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs10
3 files changed, 9 insertions, 3 deletions
diff --git a/README b/README
index 10c3571f4..7efc00e26 100644
--- a/README
+++ b/README
@@ -485,7 +485,7 @@ Options affecting specific writers
for a file `reference.docx` in the user data directory (see
`--data-dir`). If this is not found either, sensible defaults will be
used. The following styles are used by pandoc: [paragraph]
- Normal, Title, Authors, Date, Heading 1, Heading 2, Heading 3,
+ Normal, Compact, Title, Authors, Date, Heading 1, Heading 2, Heading 3,
Heading 4, Heading 5, Block Quote, Definition Term, Definition,
Body Text, Table Caption, Image Caption; [character] Default
Paragraph Font, Body Text Char, Verbatim Char, Footnote Ref,
diff --git a/data/reference.docx b/data/reference.docx
index b1d0ab15d..42c14a906 100644
--- a/data/reference.docx
+++ b/data/reference.docx
Binary files differ
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