@@ -51,6 +51,9 @@ module Text.Pandoc.Readers.Docx.Parse ( Docx(..)
51 , ParagraphStyle(..)
51 , ParagraphStyle(..)
53 , Cell(..)
53 , Cell(..)
54 , archiveToDocx
57 , archiveToDocx
55 , archiveToDocxWithWarnings
58 , archiveToDocxWithWarnings
@@ -198,6 +201,15 @@ data ParIndentation = ParIndentation { leftParIndent :: Maybe Integer
198 , hangingParIndent :: Maybe Integer}
201 , hangingParIndent :: Maybe Integer}
199 deriving Show
202 deriving Show
204+data ChangeType = Insertion | Deletion
207+data ChangeInfo = ChangeInfo ChangeId Author ChangeDate
210+data TrackedChange = TrackedChange ChangeType ChangeInfo
201data ParagraphStyle = ParagraphStyle { pStyle :: [String]
213data ParagraphStyle = ParagraphStyle { pStyle :: [String]
202 , indentation :: Maybe ParIndentation
214 , indentation :: Maybe ParIndentation
203 , dropCap :: Bool
215 , dropCap :: Bool
@@ -241,8 +253,7 @@ data Cell = Cell [BodyPart]
241type Extent = Maybe (Double, Double)
253type Extent = Maybe (Double, Double)
243data ParPart = PlainRun Run
255data ParPart = PlainRun Run
244− | Insertion ChangeId Author ChangeDate [Run]
256+ | ChangedRuns TrackedChange [Run]
245− | Deletion ChangeId Author ChangeDate [Run]
246 | CommentStart CommentId Author CommentDate [BodyPart]
257 | CommentStart CommentId Author CommentDate [BodyPart]
247 | CommentEnd CommentId
258 | CommentEnd CommentId
248 | BookMark BookMarkId Anchor
259 | BookMark BookMarkId Anchor
@@ -732,14 +743,16 @@ elemToParPart ns element
732 , Just cAuthor <- findAttrByName ns "w" "author" element
743 , Just cAuthor <- findAttrByName ns "w" "author" element
733 , Just cDate <- findAttrByName ns "w" "date" element = do
744 , Just cDate <- findAttrByName ns "w" "date" element = do
734 runs <- mapD (elemToRun ns) (elChildren element)
745 runs <- mapD (elemToRun ns) (elChildren element)
746+ return $ ChangedRuns
735− return $ Insertion cId cAuthor cDate runs
747+ (TrackedChange Insertion (ChangeInfo cId cAuthor cDate)) runs
736elemToParPart ns element
748elemToParPart ns element
737 | isElem ns "w" "del" element || isElem ns "w" "moveFrom" element
749 | isElem ns "w" "del" element || isElem ns "w" "moveFrom" element
738 , Just cId <- findAttrByName ns "w" "id" element
750 , Just cId <- findAttrByName ns "w" "id" element
739 , Just cAuthor <- findAttrByName ns "w" "author" element
751 , Just cAuthor <- findAttrByName ns "w" "author" element
740 , Just cDate <- findAttrByName ns "w" "date" element = do
752 , Just cDate <- findAttrByName ns "w" "date" element = do
741 runs <- mapD (elemToRun ns) (elChildren element)
753 runs <- mapD (elemToRun ns) (elChildren element)
754+ return $ ChangedRuns
742− return $ Deletion cId cAuthor cDate runs
755+ (TrackedChange Deletion (ChangeInfo cId cAuthor cDate)) runs
743elemToParPart ns element
756elemToParPart ns element
744 | isElem ns "w" "smartTag" element = do
757 | isElem ns "w" "smartTag" element = do
745 runs <- mapD (elemToRun ns) (elChildren element)
758 runs <- mapD (elemToRun ns) (elChildren element)