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:
parent
c343f1a90b
commit
38e1d3e95b
1 changed files with 17 additions and 1 deletions
|
@ -541,7 +541,7 @@ elemToRun _ _ = Nothing
|
||||||
|
|
||||||
elemToRunElem :: NameSpaces -> Element -> Maybe RunElem
|
elemToRunElem :: NameSpaces -> Element -> Maybe RunElem
|
||||||
elemToRunElem ns element
|
elemToRunElem ns element
|
||||||
| qName (elName element) == "t" &&
|
| (qName (elName element) == "t" || qName (elName element) == "delText") &&
|
||||||
qURI (elName element) == (lookup "w" ns) =
|
qURI (elName element) == (lookup "w" ns) =
|
||||||
Just $ TextRun (strContent element)
|
Just $ TextRun (strContent element)
|
||||||
| qName (elName element) == "br" &&
|
| qName (elName element) == "br" &&
|
||||||
|
@ -581,6 +581,22 @@ elemToParPart ns element
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
r <- elemToRun ns element
|
r <- elemToRun ns element
|
||||||
return $ PlainRun r
|
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
|
elemToParPart ns element
|
||||||
| qName (elName element) == "bookmarkStart" &&
|
| qName (elName element) == "bookmarkStart" &&
|
||||||
qURI (elName element) == (lookup "w" ns) = do
|
qURI (elName element) == (lookup "w" ns) = do
|
||||||
|
|
Loading…
Reference in a new issue