@@ -51,6 +51,9 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..)
5151 , ParagraphStyle(..)
5252 , Row(..)
5353 , Cell(..)
54+ , TrackedChange(..)
55+ , ChangeType(..)
56+ , ChangeInfo(..)
5457 , archiveToDocx
5558 , archiveToDocxWithWarnings
5659 ) where
@@ -198,6 +201,15 @@ data ParIndentation = ParIndentation { leftParIndent :: Maybe Integer
198201 , hangingParIndent :: Maybe Integer}
199202 deriving Show
200203
204+data ChangeType = Insertion | Deletion
205+ deriving Show
206+
207+data ChangeInfo = ChangeInfo ChangeId Author ChangeDate
208+ deriving Show
209+
210+data TrackedChange = TrackedChange ChangeType ChangeInfo
211+ deriving Show
212+
201213data ParagraphStyle = ParagraphStyle { pStyle :: [String]
202214 , indentation :: Maybe ParIndentation
203215 , dropCap :: Bool
@@ -241,8 +253,7 @@ data Cell = Cell [BodyPart]
241253type Extent = Maybe (Double, Double)
242254
243255data ParPart = PlainRun Run
244− | Insertion ChangeId Author ChangeDate [Run]
245− | Deletion ChangeId Author ChangeDate [Run]
256+ | ChangedRuns TrackedChange [Run]
246257 | CommentStart CommentId Author CommentDate [BodyPart]
247258 | CommentEnd CommentId
248259 | BookMark BookMarkId Anchor
@@ -732,14 +743,16 @@ elemToParPart ns element
732743 , Just cAuthor <- findAttrByName ns "w" "author" element
733744 , Just cDate <- findAttrByName ns "w" "date" element = do
734745 runs <- mapD (elemToRun ns) (elChildren element)
735− return $ Insertion cId cAuthor cDate runs
746+ return $ ChangedRuns
747+ (TrackedChange Insertion (ChangeInfo cId cAuthor cDate)) runs
736748elemToParPart ns element
737749 | isElem ns "w" "del" element || isElem ns "w" "moveFrom" element
738750 , Just cId <- findAttrByName ns "w" "id" element
739751 , Just cAuthor <- findAttrByName ns "w" "author" element
740752 , Just cDate <- findAttrByName ns "w" "date" element = do
741753 runs <- mapD (elemToRun ns) (elChildren element)
742− return $ Deletion cId cAuthor cDate runs
754+ return $ ChangedRuns
755+ (TrackedChange Deletion (ChangeInfo cId cAuthor cDate)) runs
743756elemToParPart ns element
744757 | isElem ns "w" "smartTag" element = do
745758 runs <- mapD (elemToRun ns) (elChildren element)