Docx writer: allow empty paragraphs.
See #2252. This also changes fixDisplayMath from Text.Pandoc.Writers.Shared so that it no longer produces empty Para as an artifact. (That was the original reason the writer omitted them.)
This commit is contained in:
parent
d6c58eb836
commit
92c527713b
2 changed files with 8 additions and 4 deletions
|
@ -922,8 +922,6 @@ blockToOpenXML' opts (Para [Image attr alt (src,'f':'i':'g':':':tit)]) = do
|
|||
captionNode <- withParaProp (pCustomStyle "ImageCaption")
|
||||
$ blockToOpenXML opts (Para alt)
|
||||
return $ mknode "w:p" [] (paraProps ++ contents) : captionNode
|
||||
-- fixDisplayMath sometimes produces a Para [] as artifact
|
||||
blockToOpenXML' _ (Para []) = return []
|
||||
blockToOpenXML' opts (Para lst) = do
|
||||
isFirstPara <- gets stFirstPara
|
||||
paraProps <- getParaProps $ case lst of
|
||||
|
|
|
@ -196,13 +196,19 @@ fixDisplayMath :: Block -> Block
|
|||
fixDisplayMath (Plain lst)
|
||||
| any isDisplayMath lst && not (all isDisplayMath lst) =
|
||||
-- chop into several paragraphs so each displaymath is its own
|
||||
Div ("",["math"],[]) $ map (Plain . stripLeadingTrailingSpace) $
|
||||
Div ("",["math"],[]) $
|
||||
map Plain $
|
||||
filter (not . null) $
|
||||
map 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
|
||||
Div ("",["math"],[]) $ map (Para . stripLeadingTrailingSpace) $
|
||||
Div ("",["math"],[]) $
|
||||
map Para $
|
||||
filter (not . null) $
|
||||
map stripLeadingTrailingSpace $
|
||||
groupBy (\x y -> (isDisplayMath x && isDisplayMath y) ||
|
||||
not (isDisplayMath x || isDisplayMath y)) lst
|
||||
fixDisplayMath x = x
|
||||
|
|
Loading…
Reference in a new issue