@@ -56,7 +56,7 @@ import Text.Pandoc.Walk
5656import Text.Pandoc.Writers.Shared (fixDisplayMath)
5757import Text.Pandoc.Writers.OOXML
5858import qualified Data.Map as M
59−import Data.Maybe (mapMaybe, listToMaybe)
59+import Data.Maybe (mapMaybe, listToMaybe, maybeToList)
6060import Text.Pandoc.ImageSize
6161import Control.Applicative ((<|>))
6262
@@ -1200,7 +1200,7 @@ paragraphToElement par = do
12001200 [mknode "a:buAutoNum" [("type", autoNumberingToType attrs')] ()]
12011201 Nothing -> [mknode "a:buNone" [] ()]
12021202 )
1203− paras <- mapM paraElemToElement (paraElems par)
1203+ paras <- mapM paraElemToElement (combineParaElems $ paraElems par)
12041204 return $ mknode "a:p" [] $ [mknode "a:pPr" attrs props] ++ paras
12051205
12061206shapeToElement :: PandocMonad m => Element -> Shape -> P m Element
@@ -1758,3 +1758,20 @@ getContentType fp
17581758 | "ppt" : "slideLayouts" : _ : [] <- splitDirectories fp=
17591759 Just $ presML ++ ".slideLayout+xml"
17601760 | otherwise = Nothing
1761+
1762+-------------------------------------------------------
1763+
1764+combineParaElems' :: Maybe ParaElem -> [ParaElem] -> [ParaElem]
1765+combineParaElems' mbPElem [] = maybeToList mbPElem
1766+combineParaElems' Nothing (pElem : pElems) =
1767+ combineParaElems' (Just pElem) pElems
1768+combineParaElems' (Just pElem') (pElem : pElems)
1769+ | Run rPr' s' <- pElem'
1770+ , Run rPr s <- pElem
1771+ , rPr == rPr' =
1772+ combineParaElems' (Just $ Run rPr' $ s' ++ s) pElems
1773+ | otherwise =
1774+ pElem' : combineParaElems' (Just pElem) pElems
1775+
1776+combineParaElems :: [ParaElem] -> [ParaElem]
1777+combineParaElems = combineParaElems' Nothing