diff options
author | Nikolay Yakimov <root@livid.pp.ru> | 2015-02-22 00:19:58 +0300 |
---|---|---|
committer | Nikolay Yakimov <root@livid.pp.ru> | 2015-02-22 00:19:58 +0300 |
commit | 80715ecd7a39288aef501b3550b45cb2f121df10 (patch) | |
tree | 609d2ca566b327a5d631c7ded81d4e9c0aed7e4c /src/Text/Pandoc | |
parent | 5cdd11725c2db417f7f93d09fdb7ead90d1700a6 (diff) | |
download | pandoc-80715ecd7a39288aef501b3550b45cb2f121df10.tar.gz |
Prototype fix for #1872
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 437422451..a240997ab 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -394,7 +394,7 @@ writeDocx opts doc@(Pandoc meta _) = do linkrels -- styles - let newstyles = styleToOpenXml $ writerHighlightStyle opts + let newstyles = styleToOpenXml charStyles $ writerHighlightStyle opts let styledoc' = styledoc{ elContent = elContent styledoc ++ [Elem x | x <- newstyles, writerHighlight opts] } let styleEntry = toEntry stylepath epochtime $ renderXml styledoc' @@ -473,10 +473,13 @@ writeDocx opts doc@(Pandoc meta _) = do miscRelEntries ++ otherMediaEntries return $ fromArchive archive -styleToOpenXml :: Style -> [Element] -styleToOpenXml style = parStyle : map toStyle alltoktypes +styleToOpenXml :: CharStyleMap -> Style -> [Element] +styleToOpenXml (CharStyleMap m) style = parStyle : mapMaybe toStyle alltoktypes where alltoktypes = enumFromTo KeywordTok NormalTok - toStyle toktype = mknode "w:style" [("w:type","character"), + toStyle toktype = + if M.member (map toLower $ show toktype) m then Nothing + else Just $ + mknode "w:style" [("w:type","character"), ("w:customStyle","1"),("w:styleId",show toktype)] [ mknode "w:name" [("w:val",show toktype)] () , mknode "w:basedOn" [("w:val","VerbatimChar")] () |