Docx reader: Parse Insertions and Deletions.

This is just for the Parse module, reading it into the Docx format. It
still has to be translated into pandoc.
This commit is contained in:
Jesse Rosenthal 2014-06-25 10:32:48 -04:00
parent c343f1a90b
commit 38e1d3e95b

View file

@ -541,7 +541,7 @@ elemToRun _ _ = Nothing
elemToRunElem :: NameSpaces -> Element -> Maybe RunElem
elemToRunElem ns element
| qName (elName element) == "t" &&
| (qName (elName element) == "t" || qName (elName element) == "delText") &&
qURI (elName element) == (lookup "w" ns) =
Just $ TextRun (strContent element)
| qName (elName element) == "br" &&
@ -581,6 +581,22 @@ elemToParPart ns element
Nothing -> do
r <- elemToRun ns element
return $ PlainRun r
elemToParPart ns element
| qName (elName element) == "ins" &&
qURI (elName element) == (lookup "w" ns) = do
cId <- findAttr (QName "id" (lookup "w" ns) (Just "w")) element
cAuthor <- findAttr (QName "author" (lookup "w" ns) (Just "w")) element
cDate <- findAttr (QName "date" (lookup "w" ns) (Just "w")) element
let runs = mapMaybe (elemToRun ns) (elChildren element)
return $ Insertion cId cAuthor cDate runs
elemToParPart ns element
| qName (elName element) == "del" &&
qURI (elName element) == (lookup "w" ns) = do
cId <- findAttr (QName "id" (lookup "w" ns) (Just "w")) element
cAuthor <- findAttr (QName "author" (lookup "w" ns) (Just "w")) element
cDate <- findAttr (QName "date" (lookup "w" ns) (Just "w")) element
let runs = mapMaybe (elemToRun ns) (elChildren element)
return $ Deletion cId cAuthor cDate runs
elemToParPart ns element
| qName (elName element) == "bookmarkStart" &&
qURI (elName element) == (lookup "w" ns) = do