git.iko.soy/typeable/pandoc
on master help sign in
If --no-highlight is set, remove *Tok styles.
commit8b3acde9deaeb30ba75299001ea1b15345983f3c authorNikolay Yakimov <root@livid.pp.ru> dateSun 22 Feb 2015, 23:25 (12 years ago) parent80715ec
1 file changed+10−2
src/Text/Pandoc/Writers/Docx.hs+10−2
src/Text/Pandoc/Writers/Docx.hs+10−2
@@ -395,8 +395,16 @@ writeDocx opts doc@(Pandoc meta _) = do
395395
396396 -- styles
397397 let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts
398− let styledoc' = styledoc{ elContent = elContent styledoc ++
399− [Elem x | x <- newstyles, writerHighlight opts] }
398+ let styledoc' = styledoc{ elContent = modifyContent (elContent styledoc) }
399+ where
400+ modifyContent
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
400408 let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
401409
402410 -- construct word/numbering.xml