summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEdwin Török <edwin@etorok.net>2023-12-18 23:20:22 +0000
committerJohn MacFarlane <jgm@berkeley.edu>2023-12-18 17:15:03 -0800
commitc5780857e5ebe54246d3066e7aa95424309bd05c (patch)
treee6ef50194252e247c2cfbc7069a98a72931dd4c7 /src
parent3e360f5a3e52852e349361d83280a3d21f051e04 (diff)
fix(docx): fix OOXMLValidator error on KeywordTok output
xmllint doesn't warn about this (maybe because the tag is empty?), but the order doesn't match wml.xsd: ``` <w:rPr> <w:color w:val="007020"/> <w:b/> </w:rPr> ``` And OOXMLValidatorCLI does warn about it: ``` { "Description": "The element has unexpected child element 'http://schemas.openxmlformats.org/wordprocessingml/2006/main:b'.", "Path": { "NamespacesDefinitions": [ "xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"" ], "Namespaces": { }, "XPath": "/w:styles[1]/w:style[40]/w:rPr[1]", "PartUri": "/word/styles.xml" }, "Id": "Sch_UnexpectedElementContentExpectingComplex", "ErrorType": "Schema" } ``` Signed-off-by: Edwin Török <edwin@etorok.net>
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index b8f8cf58a..7db854187 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -679,14 +679,14 @@ styleToOpenXml sm style =
[ mknode "w:name" [("w:val", tshow toktype)] ()
, mknode "w:basedOn" [("w:val","VerbatimChar")] ()
, mknode "w:rPr" [] $
+ [ mknode "w:b" [] () | tokFeature tokenBold toktype ] ++
+ [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++
[ mknode "w:color" [("w:val", tokCol toktype)] ()
| tokCol toktype /= "auto" ] ++
+ [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ] ++
[ mknode "w:shd" [("w:val","clear")
,("w:fill",tokBg toktype)] ()
- | tokBg toktype /= "auto" ] ++
- [ mknode "w:b" [] () | tokFeature tokenBold toktype ] ++
- [ mknode "w:i" [] () | tokFeature tokenItalic toktype ] ++
- [ mknode "w:u" [] () | tokFeature tokenUnderline toktype ]
+ | tokBg toktype /= "auto" ]
]
tokStyles = tokenStyles style
tokFeature f toktype = maybe False f $ M.lookup toktype tokStyles