diff options
author | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-06-25 10:32:48 -0400 |
---|---|---|
committer | Jesse Rosenthal <jrosenthal@jhu.edu> | 2014-06-25 10:32:48 -0400 |
commit | 38e1d3e95b8240eeb35db0a1a56e308cfb4835e4 (patch) | |
tree | 616fce435f133d0c7fa564698b9ba7454faadda5 /src | |
parent | c343f1a90bc35d745de673de5ff771ddbe60be54 (diff) | |
download | pandoc-38e1d3e95b8240eeb35db0a1a56e308cfb4835e4.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Docx/Parse.hs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Docx/Parse.hs b/src/Text/Pandoc/Readers/Docx/Parse.hs index 1cb5fe2e3..c76ef7511 100644 --- a/src/Text/Pandoc/Readers/Docx/Parse.hs +++ b/src/Text/Pandoc/Readers/Docx/Parse.hs @@ -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" && @@ -582,6 +582,22 @@ elemToParPart ns element 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 bmId <- findAttr (QName "id" (lookup "w" ns) (Just "w")) element |