aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/OpenDocument.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-05-16 14:37:33 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-05-16 14:37:33 -0700
commita2ce28fa4d0e90fc2cd1e4d3a6d738005323164f (patch)
treee309314f2b45632b01187b70d265763a62e6c041 /src/Text/Pandoc/Writers/OpenDocument.hs
parent6082e7392774a9924d749ad7a0a92a4d771e9a4f (diff)
downloadpandoc-a2ce28fa4d0e90fc2cd1e4d3a6d738005323164f.tar.gz
OpenDocument/ODT writer: enable custom-style attribute on a Div.
This allows you to apply a custom style to contained paragraphs.
Diffstat (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs')
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index b868e168b..6fd0dd5dd 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -349,8 +349,12 @@ blockToOpenDocument o bs
then return empty
else inParagraphTags =<< inlinesToOpenDocument o b
| LineBlock b <- bs = blockToOpenDocument o $ linesToPara b
- | Div attr xs <- bs = withLangFromAttr attr
- (blocksToOpenDocument o xs)
+ | Div attr xs <- bs = do
+ let (_,_,kvs) = attr
+ withLangFromAttr attr $
+ case lookup "custom-style" kvs of
+ Just sty -> withParagraphStyle o sty xs
+ _ -> blocksToOpenDocument o xs
| Header i (ident,_,_) b
<- bs = setFirstPara >> (inHeaderTags i ident
=<< inlinesToOpenDocument o b)