@@ -86,6 +86,10 @@ maybeToD :: Maybe a -> D a
86maybeToD (Just a) = return a
86maybeToD (Just a) = return a
87maybeToD Nothing = throwError DocxError
87maybeToD Nothing = throwError DocxError
89+eitherToD :: Either a b -> D b
90+eitherToD (Right b) = return b
91+eitherToD (Left _) = throwError DocxError
89concatMapM :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
93concatMapM :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
90concatMapM f xs = liftM concat (mapM f xs)
94concatMapM f xs = liftM concat (mapM f xs)
@@ -150,7 +154,7 @@ defaultParagraphStyle = ParagraphStyle { pStyle = []
150data BodyPart = Paragraph ParagraphStyle [ParPart]
154data BodyPart = Paragraph ParagraphStyle [ParPart]
151 | ListItem ParagraphStyle String String Level [ParPart]
155 | ListItem ParagraphStyle String String Level [ParPart]
152 | Tbl String TblGrid TblLook [Row]
156 | Tbl String TblGrid TblLook [Row]
153− | OMathPara [[Exp]]
157+ | OMathPara [Exp]
154 deriving Show
158 deriving Show
156type TblGrid = [Integer]
160type TblGrid = [Integer]
@@ -475,7 +479,7 @@ elemToBodyPart ns element
475 | isElem ns "w" "p" element
479 | isElem ns "w" "p" element
476 , (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
480 , (c:_) <- findChildren (elemName ns "m" "oMathPara") element =
478− expsLst <- mapD (\e -> (maybeToD $ readOMML e)) (elChildren c)
482+ expsLst <- eitherToD $ readOMML $ showElement c
479 return $ OMathPara expsLst
483 return $ OMathPara expsLst
480elemToBodyPart ns element
484elemToBodyPart ns element
481 | isElem ns "w" "p" element
485 | isElem ns "w" "p" element
@@ -575,7 +579,7 @@ elemToParPart ns element
575 Nothing -> ExternalHyperLink "" runs
579 Nothing -> ExternalHyperLink "" runs
576elemToParPart ns element
580elemToParPart ns element
577 | isElem ns "m" "oMath" element =
581 | isElem ns "m" "oMath" element =
578− (maybeToD $ readOMML element) >>= (return . PlainOMath)
582+ (eitherToD $ readOMML $ showElement element) >>= (return . PlainOMath)
579elemToParPart _ _ = throwError WrongElem
583elemToParPart _ _ = throwError WrongElem
581lookupFootnote :: String -> Notes -> Maybe Element
585lookupFootnote :: String -> Notes -> Maybe Element