git.iko.soy/typeable/pandoc
on master help sign in
Fixed small bug in RST list parsing.

See #3432. Previously the parser didn't handle properly this case: * - a - b * - c - d

commit1a23bc65b8e8a07d2578ddb0f3b842353ba81dcf authorJohn MacFarlane <jgm@berkeley.edu> dateSat 11 Feb 2017, 20:55 (10 years ago) parent92a5445
2 files changed+21−3
src/Text/Pandoc/Readers/RST.hs+2−3 test/command/3432a.md+19
src/Text/Pandoc/Readers/RST.hs+2−3
@@ -548,8 +548,7 @@ listItem :: PandocMonad m
548548listItem start = try $ do
549549 (markerLength, first) <- rawListItem start
550550 rest <- many (listContinuation markerLength)
551− blanks <- choice [ try (many blankline <* lookAhead start),
552− many1 blankline ] -- whole list must end with blank.
551+ skipMany1 blankline <|> () <$ lookAhead start
553552 -- parsing with ListItemState forces markers at beginning of lines to
554553 -- count as list item markers, even if not separated by blank space.
555554 -- see definition of "endline"
@@ -557,7 +556,7 @@ listItem start = try $ do
557556 let oldContext = stateParserContext state
558557 setState $ state {stateParserContext = ListItemState}
559558 -- parse the extracted block, which may itself contain block elements
560− parsed <- parseFromString parseBlocks $ concat (first:rest) ++ blanks
559+ parsed <- parseFromString parseBlocks $ concat (first:rest) ++ "\n"
561560 updateState (\st -> st {stateParserContext = oldContext})
562561 return $ case B.toList parsed of
563562 [Para xs] -> B.singleton $ Plain xs
test/command/3432a.mdnew file+19
@@ -0,0 +1,19 @@
1+```
2+% pandoc -f rst
3+* - a
4+ - b
5+* - c
6+ - d
7+^D
8+<ul>
9+<li><ul>
10+<li>a</li>
11+<li>b</li>
12+</ul></li>
13+<li><ul>
14+<li>c</li>
15+<li>d</li>
16+</ul></li>
17+</ul>
18+```
19+