git.iko.soy/typeable/pandoc
on master help sign in
RST reader: apply `.. class::` directly to following Header.

rather than creating a surrounding Div. Closes #6699.

commit188c444990f7ae70556f8bfc94b25c8dc7f77f98 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 25 Sep 2020, 09:05 (6 years ago) parent6119125
2 files changed+19−1
src/Text/Pandoc/Readers/RST.hs+6−1 test/command/6699.md+13
src/Text/Pandoc/Readers/RST.hs+6−1
@@ -758,7 +758,12 @@ directive' = do
758758 children <- case body of
759759 "" -> block
760760 _ -> parseFromString' parseBlocks body'
761− return $ B.divWith attrs children
761+ return $
762+ case B.toList children of
763+ [Header lev attrs' ils]
764+ | T.null body -> -- # see #6699
765+ B.headerWith (attrs' <> attrs) lev (B.fromList ils)
766+ _ -> B.divWith attrs children
762767 other -> do
763768 pos <- getPosition
764769 logMessage $ SkippedContent (".. " <> other) pos
test/command/6699.mdnew file+13
@@ -0,0 +1,13 @@
1+```
2+% pandoc -f rst -t native
3+.. class:: allowframebreaks
4+
5+title
6+-----
7+
8+text
9+^D
10+[Header 1 ("title",["allowframebreaks"],[]) [Str "title"]
11+,Para [Str "text"]]
12+```
13+