git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Support bold and italic in "complex script."

Previously bold and italics didn't work properly in LTR text. This commit causes the w:bCs and w:iCs attributes to be used, in addition to w:b and w:i, for bold and italics respectively. Closes #6911.

commit5bbd5a9e80c4f4356d71b54315cf75b5ae2f3650 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 3 Dec 2020, 09:51 (6 years ago) parentaab54c4
4 files changed+6−2
src/Text/Pandoc/Writers/Docx.hs+6−2 test/docx/golden/custom_style_preserve.docx test/docx/golden/definition_list.docx test/docx/golden/inline_formatting.docx
src/Text/Pandoc/Writers/Docx.hs+6−2
@@ -1272,9 +1272,13 @@ inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
12721272 $ inlinesToOpenXML opts ils
12731273 wrapBookmark ident contents
12741274inlineToOpenXML' opts (Strong lst) =
1275− withTextProp (mknode "w:b" [] ()) $ inlinesToOpenXML opts lst
1275+ withTextProp (mknode "w:b" [] ()) $
1276+ withTextProp (mknode "w:bCs" [] ()) $ -- needed for LTR, #6911
1277+ inlinesToOpenXML opts lst
12761278inlineToOpenXML' opts (Emph lst) =
1277− withTextProp (mknode "w:i" [] ()) $ inlinesToOpenXML opts lst
1279+ withTextProp (mknode "w:i" [] ()) $
1280+ withTextProp (mknode "w:iCs" [] ()) $ -- needed for LTR, #6911
1281+ inlinesToOpenXML opts lst
12781282inlineToOpenXML' opts (Underline lst) =
12791283 withTextProp (mknode "w:u" [("w:val","single")] ()) $
12801284 inlinesToOpenXML opts lst
test/docx/golden/custom_style_preserve.docx

Binary file not shown.

test/docx/golden/definition_list.docx

Binary file not shown.

test/docx/golden/inline_formatting.docx

Binary file not shown.