git.iko.soy/typeable/pandoc
on master help sign in
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.

commitd6b60558e3d6e4e1f0aace48b37c904915561657 authorJesse Rosenthal <jrosenthal@jhu.edu> dateMon 15 Aug 2016, 12:35 (10 years ago) parent59bc1e6
1 file changed+5−1
src/Text/Pandoc/Writers/Docx.hs+5−1
src/Text/Pandoc/Writers/Docx.hs+5−1
@@ -1010,7 +1010,11 @@ inlineToOpenXML :: WriterOptions -> Inline -> WS [Element]
10101010inlineToOpenXML _ (Str str) = formattedString str
10111011inlineToOpenXML opts Space = inlineToOpenXML opts (Str " ")
10121012inlineToOpenXML opts SoftBreak = inlineToOpenXML opts (Str " ")
1013−inlineToOpenXML opts (Span (_,classes,kvs) ils)
1013+inlineToOpenXML opts (Span (ident,classes,kvs) ils)
1014+ | Just sty <- lookup dynamicStyleKey kvs = do
1015+ let kvs' = filter ((dynamicStyleKey, sty)/=) kvs
1016+ withTextProp (rCustomStyle sty) $
1017+ inlineToOpenXML opts (Span (ident,classes,kvs') ils)
10141018 | "insertion" `elem` classes = do
10151019 defaultAuthor <- gets stChangesAuthor
10161020 defaultDate <- gets stChangesDate