git.iko.soy/typeable/pandoc
on master help sign in
Docx reader: Make use of track-changes option.
commit0e9bf37f64be0a121a0d682570fc8f0cf2b27c51 authorJesse Rosenthal <jrosenthal@jhu.edu> dateWed 25 Jun 2014, 14:17 (12 years ago) parentaa194d3
1 file changed+16−3
src/Text/Pandoc/Readers/Docx.hs+16−3
src/Text/Pandoc/Readers/Docx.hs+16−3
@@ -234,9 +234,22 @@ runToInlines opts docx@(Docx _ notes _ _ _) (Endnote fnId) =
234234
235235parPartToInlines :: ReaderOptions -> Docx -> ParPart -> [Inline]
236236parPartToInlines opts docx (PlainRun r) = runToInlines opts docx r
237−parPartToInlines opts docx (Insertion _ _ _ runs) =
238− concatMap (runToInlines opts docx) runs
239−parPartToInlines _ _ (Deletion _ _ _ _) = []
237+parPartToInlines opts docx (Insertion _ author date runs) =
238+ case readerTrackChanges opts of
239+ AcceptChanges -> concatMap (runToInlines opts docx) runs
240+ RejectChanges -> []
241+ AllChanges ->
242+ [Span
243+ ("", ["insertion"], [("author", author), ("date", date)])
244+ (concatMap (runToInlines opts docx) runs)]
245+parPartToInlines opts docx (Deletion _ author date runs) =
246+ case readerTrackChanges opts of
247+ AcceptChanges -> []
248+ RejectChanges -> concatMap (runToInlines opts docx) runs
249+ AllChanges ->
250+ [Span
251+ ("", ["deletion"], [("author", author), ("date", date)])
252+ (concatMap (runToInlines opts docx) runs)]
240253parPartToInlines _ _ (BookMark _ anchor) | anchor `elem` dummyAnchors = []
241254parPartToInlines _ _ (BookMark _ anchor) = [Span (anchor, ["anchor"], []) []]
242255parPartToInlines _ (Docx _ _ _ rels _) (Drawing relid) =