git.iko.soy/typeable/pandoc
on master help sign in
RST reader: allow empty list items (as docutils does).

Closes #4193.

commitee5fe9bf2c0617ddbad0e517f78e7fffe4e737df authorJohn MacFarlane <jgm@berkeley.edu> dateSun 24 Dec 2017, 13:02 (9 years ago) parentbb5f4c9
2 files changed+12−2
src/Text/Pandoc/Readers/RST.hs+2−2 test/command/4193.md+10
src/Text/Pandoc/Readers/RST.hs+2−2
@@ -547,7 +547,7 @@ bulletListStart :: Monad m => ParserT [Char] st m Int
547547bulletListStart = try $ do
548548 notFollowedBy' hrule -- because hrules start out just like lists
549549 marker <- oneOf bulletListMarkers
550− white <- many1 spaceChar
550+ white <- many1 spaceChar <|> "" <$ lookAhead (char '\n')
551551 return $ length (marker:white)
552552
553553-- parses ordered list start and returns its length (inc following whitespace)
@@ -556,7 +556,7 @@ orderedListStart :: Monad m => ListNumberStyle
556556 -> RSTParser m Int
557557orderedListStart style delim = try $ do
558558 (_, markerLen) <- withHorizDisplacement (orderedListMarker style delim)
559− white <- many1 spaceChar
559+ white <- many1 spaceChar <|> "" <$ lookAhead (char '\n')
560560 return $ markerLen + length white
561561
562562-- parse a line of a list item
test/command/4193.mdnew file+10
@@ -0,0 +1,10 @@
1+```
2+% pandoc -f rst -t native
3+-
4+ a
5+- b
6+^D
7+[BulletList
8+ [[Plain [Str "a"]]
9+ ,[Plain [Str "b"]]]]
10+```