git.iko.soy/typeable/pandoc
on master help sign in
If --no-highlight is set, remove *Tok styles.
8b3acdeNikolay Yakimov
src/Text/Pandoc/Writers/Docx.hs+10−2
@@ -395,8 +395,16 @@ writeDocx opts doc@(Pandoc meta _) = do
395
395
396 -- styles
396 -- styles
397 let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts
397 let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts
398− let styledoc' = styledoc{ elContent = elContent styledoc ++
398+ let styledoc' = styledoc{ elContent = modifyContent (elContent styledoc) }
399+ where
400+ modifyContent
399− [Elem x | x <- newstyles, writerHighlight opts] }
401+ | writerHighlight opts = (++ map Elem newstyles)
402+ | otherwise = filter notTokStyle
403+ notTokStyle (Elem el) = notStyle el || notTokId el
404+ notTokStyle _ = True
405+ notStyle = (/= myName "style") . elName
406+ notTokId = maybe True (`notElem` tokStys) . getAttrStyleId
407+ tokStys = map show $ enumFromTo KeywordTok NormalTok
400 let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
408 let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
401
409
402 -- construct word/numbering.xml
410 -- construct word/numbering.xml