@@ -86,6 +86,10 @@ maybeToD :: Maybe a -> D a
8686maybeToD (Just a) = return a
8787maybeToD Nothing = throwError DocxError
8888
89+eitherToD :: Either a b -> D b
90+eitherToD (Right b) = return b
91+eitherToD (Left _) = throwError DocxError
92+
8993concatMapM :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
9094concatMapM f xs = liftM concat (mapM f xs)
9195
@@ -150,7 +154,7 @@ defaultParagraphStyle = ParagraphStyle { pStyle = []
150154data BodyPart = Paragraph ParagraphStyle [ParPart]
151155 | ListItem ParagraphStyle String String Level [ParPart]
152156 | Tbl String TblGrid TblLook [Row]
153− | OMathPara [[Exp]]
157+ | OMathPara [Exp]
154158 deriving Show
155159
156160type TblGrid = [Integer]
@@ -475,7 +479,7 @@ elemToBodyPart ns element
475479 | isElem ns "w" "p" element
476480 , (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
477481 do
478− expsLst <- mapD (\e -> (maybeToD $ readOMML e)) (elChildren c)
482+ expsLst <- eitherToD $ readOMML $ showElement c
479483 return $ OMathPara expsLst
480484elemToBodyPart ns element
481485 | isElem ns "w" "p" element
@@ -575,7 +579,7 @@ elemToParPart ns element
575579 Nothing -> ExternalHyperLink "" runs
576580elemToParPart ns element
577581 | isElem ns "m" "oMath" element =
578− (maybeToD $ readOMML element) >>= (return . PlainOMath)
582+ (eitherToD $ readOMML $ showElement element) >>= (return . PlainOMath)
579583elemToParPart _ _ = throwError WrongElem
580584
581585lookupFootnote :: String -> Notes -> Maybe Element