From d6b60558e3d6e4e1f0aace48b37c904915561657 Mon Sep 17 00:00:00 2001 From: Jesse Rosenthal Date: Mon, 15 Aug 2016 12:35:11 -0400 Subject: Docx writer: Allow dynamic styles on spans. This enables dynamic styling on spans. It uses the same prefix as we used on divs ("docx-style" for the moment). It does not yet inject the style into styles.xml. --- src/Text/Pandoc/Writers/Docx.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 82f8bfcac..51cdbb621 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -1010,7 +1010,11 @@ inlineToOpenXML :: WriterOptions -> Inline -> WS [Element] inlineToOpenXML _ (Str str) = formattedString str inlineToOpenXML opts Space = inlineToOpenXML opts (Str " ") inlineToOpenXML opts SoftBreak = inlineToOpenXML opts (Str " ") -inlineToOpenXML opts (Span (_,classes,kvs) ils) +inlineToOpenXML opts (Span (ident,classes,kvs) ils) + | Just sty <- lookup dynamicStyleKey kvs = do + let kvs' = filter ((dynamicStyleKey, sty)/=) kvs + withTextProp (rCustomStyle sty) $ + inlineToOpenXML opts (Span (ident,classes,kvs') ils) | "insertion" `elem` classes = do defaultAuthor <- gets stChangesAuthor defaultDate <- gets stChangesDate -- cgit v1.2.3