aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-09-25 09:05:40 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-09-25 09:06:15 -0700
commit188c444990f7ae70556f8bfc94b25c8dc7f77f98 (patch)
tree5e2343079bed34b1c63b241c4e5e9f0edee01a30 /src
parent6119125a8b54f55c7e4c9a2f62d0282a2adcfb74 (diff)
downloadpandoc-188c444990f7ae70556f8bfc94b25c8dc7f77f98.tar.gz
RST reader: apply `.. class::` directly to following Header.
rather than creating a surrounding Div. Closes #6699.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 50947c1be..eeb3d1389 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -758,7 +758,12 @@ directive' = do
children <- case body of
"" -> block
_ -> parseFromString' parseBlocks body'
- return $ B.divWith attrs children
+ return $
+ case B.toList children of
+ [Header lev attrs' ils]
+ | T.null body -> -- # see #6699
+ B.headerWith (attrs' <> attrs) lev (B.fromList ils)
+ _ -> B.divWith attrs children
other -> do
pos <- getPosition
logMessage $ SkippedContent (".. " <> other) pos