aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Djot.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/Djot.hs')
-rw-r--r--src/Text/Pandoc/Writers/Djot.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/Djot.hs b/src/Text/Pandoc/Writers/Djot.hs
index 45ea729eb..c7e846735 100644
--- a/src/Text/Pandoc/Writers/Djot.hs
+++ b/src/Text/Pandoc/Writers/Djot.hs
@@ -100,7 +100,8 @@ blockToDjot (BlockQuote bls) = D.blockQuote <$> blocksToDjot bls
blockToDjot (Header lev attr ils) =
fmap (D.addAttr (toDjotAttr attr)) . D.heading lev <$> inlinesToDjot ils
blockToDjot HorizontalRule = pure D.thematicBreak
-blockToDjot (Div (ident,"section":cls,kvs) bls@(Header _ _ ils : _)) = do
+blockToDjot (Div (ident,"section":cls,kvs)
+ (Header lev (_,hcls,hkvs) ils : bls)) = do
ilsBs <- D.inlinesToByteString <$> inlinesToDjot ils
let ident' = toIdentifier ilsBs
let label = D.normalizeLabel ilsBs
@@ -112,8 +113,10 @@ blockToDjot (Div (ident,"section":cls,kvs) bls@(Header _ _ ils : _)) = do
fmap
(D.addAttr (toDjotAttr (if autoid then "" else ident,
filter (/= "section") cls,
- filter (\(k,_) -> k /= "wrapper") kvs))) . D.section
- <$> blocksToDjot bls
+ filter (\(k,_) -> k /= "wrapper") kvs) <>
+ toDjotAttr ("", [c | c <- hcls, c `notElem` cls], hkvs)))
+ . D.section
+ <$> blocksToDjot (Header lev mempty ils : bls)
blockToDjot (Div attr@(ident,cls,kvs) bls)
| Just "1" <- lookup "wrapper" kvs
= fmap (D.addAttr