git.iko.soy/typeable/pandoc
on master help sign in
OpenDocument/ODT writer: enable custom-style attribute on a Div.

This allows you to apply a custom style to contained paragraphs.

commita2ce28fa4d0e90fc2cd1e4d3a6d738005323164f authorJohn MacFarlane <jgm@berkeley.edu> dateSat 16 May 2020, 14:37 (6 years ago) parent6082e73
1 file changed+6−2
src/Text/Pandoc/Writers/OpenDocument.hs+6−2
src/Text/Pandoc/Writers/OpenDocument.hs+6−2
@@ -349,8 +349,12 @@ blockToOpenDocument o bs
349349 then return empty
350350 else inParagraphTags =<< inlinesToOpenDocument o b
351351 | LineBlock b <- bs = blockToOpenDocument o $ linesToPara b
352− | Div attr xs <- bs = withLangFromAttr attr
353− (blocksToOpenDocument o xs)
352+ | Div attr xs <- bs = do
353+ let (_,_,kvs) = attr
354+ withLangFromAttr attr $
355+ case lookup "custom-style" kvs of
356+ Just sty -> withParagraphStyle o sty xs
357+ _ -> blocksToOpenDocument o xs
354358 | Header i (ident,_,_) b
355359 <- bs = setFirstPara >> (inHeaderTags i ident
356360 =<< inlinesToOpenDocument o b)