summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Docx.hs
diff options
context:
space:
mode:
authorNikolay Yakimov <root@livid.pp.ru>2015-02-22 23:25:12 +0300
committerNikolay Yakimov <root@livid.pp.ru>2015-02-22 23:25:12 +0300
commit8b3acde9deaeb30ba75299001ea1b15345983f3c (patch)
tree487cdaf2a19f46733efebe3fa417332993f61abd /src/Text/Pandoc/Writers/Docx.hs
parent80715ecd7a39288aef501b3550b45cb2f121df10 (diff)
If --no-highlight is set, remove *Tok styles.
Diffstat (limited to 'src/Text/Pandoc/Writers/Docx.hs')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index a240997ab..64da9a497 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -395,8 +395,16 @@ writeDocx opts doc@(Pandoc meta _) = do
-- styles
let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts
- let styledoc' = styledoc{ elContent = elContent styledoc ++
- [Elem x | x <- newstyles, writerHighlight opts] }
+ let styledoc' = styledoc{ elContent = modifyContent (elContent styledoc) }
+ where
+ modifyContent
+ | writerHighlight opts = (++ map Elem newstyles)
+ | otherwise = filter notTokStyle
+ notTokStyle (Elem el) = notStyle el || notTokId el
+ notTokStyle _ = True
+ notStyle = (/= myName "style") . elName
+ notTokId = maybe True (`notElem` tokStys) . getAttrStyleId
+ tokStys = map show $ enumFromTo KeywordTok NormalTok
let styleEntry = toEntry stylepath epochtime $ renderXml styledoc'
-- construct word/numbering.xml