summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2014-06-25 14:17:20 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2014-06-25 14:17:20 -0400
commit0e9bf37f64be0a121a0d682570fc8f0cf2b27c51 (patch)
tree616f0d9cc13d5047f801ea5a4cff0390c283037f
parentaa194d387c103d001fc911f37d4cfc26be98d93c (diff)
Docx reader: Make use of track-changes option.
-rw-r--r--src/Text/Pandoc/Readers/Docx.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Docx.hs b/src/Text/Pandoc/Readers/Docx.hs
index 130e2a1e2..cb0735e31 100644
--- a/src/Text/Pandoc/Readers/Docx.hs
+++ b/src/Text/Pandoc/Readers/Docx.hs
@@ -234,9 +234,22 @@ runToInlines opts docx@(Docx _ notes _ _ _) (Endnote fnId) =
parPartToInlines :: ReaderOptions -> Docx -> ParPart -> [Inline]
parPartToInlines opts docx (PlainRun r) = runToInlines opts docx r
-parPartToInlines opts docx (Insertion _ _ _ runs) =
- concatMap (runToInlines opts docx) runs
-parPartToInlines _ _ (Deletion _ _ _ _) = []
+parPartToInlines opts docx (Insertion _ author date runs) =
+ case readerTrackChanges opts of
+ AcceptChanges -> concatMap (runToInlines opts docx) runs
+ RejectChanges -> []
+ AllChanges ->
+ [Span
+ ("", ["insertion"], [("author", author), ("date", date)])
+ (concatMap (runToInlines opts docx) runs)]
+parPartToInlines opts docx (Deletion _ author date runs) =
+ case readerTrackChanges opts of
+ AcceptChanges -> []
+ RejectChanges -> concatMap (runToInlines opts docx) runs
+ AllChanges ->
+ [Span
+ ("", ["deletion"], [("author", author), ("date", date)])
+ (concatMap (runToInlines opts docx) runs)]
parPartToInlines _ _ (BookMark _ anchor) | anchor `elem` dummyAnchors = []
parPartToInlines _ _ (BookMark _ anchor) = [Span (anchor, ["anchor"], []) []]
parPartToInlines _ (Docx _ _ _ rels _) (Drawing relid) =