diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-18 15:26:29 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2007-08-18 15:26:29 +0000 |
commit | e48f046aa024fea9f806368796eaaaed1f09ceaf (patch) | |
tree | 368f96d85012242b4918190b6fd20e3c32fd9228 /src | |
parent | fcda8d191b7683779fdce93beb9814960e749df9 (diff) | |
download | pandoc-e48f046aa024fea9f806368796eaaaed1f09ceaf.tar.gz |
+ Fixed bug in markdown ordered list parsing. The problem was
that anyOrderedListStart did not check for a space following the
ordered list marker. So, 'A.B. 2007' would be parsed as a list item,
then fail because of the lack of space after 'A.' (required by
orderedListStart). Resolves Issue #22.
+ Fixed a similar problem in RST reader.
+ Added regression test.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@861 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 5 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 6ee8df7b6..abf8061e0 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -334,8 +334,9 @@ anyOrderedListStart = try $ do if stateStrict state then do many1 digit char '.' + spaceChar return (1, DefaultStyle, DefaultDelim) - else anyOrderedListMarker + else anyOrderedListMarker >>~ spaceChar orderedListStart style delim = try $ do optional newline -- if preceded by a Plain block in a list context @@ -346,7 +347,7 @@ orderedListStart style delim = try $ do char '.' return 1 else orderedListMarker style delim - oneOf spaceChars + spaceChar skipSpaces -- parse a line of a list item (start = parser for beginning of list item) diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index ce8fedf02..878c1355c 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -418,7 +418,7 @@ listItem start = try $ do return parsed orderedList = try $ do - (start, style, delim) <- lookAhead anyOrderedListMarker + (start, style, delim) <- lookAhead (anyOrderedListMarker >>~ spaceChar) items <- many1 (listItem (orderedListStart style delim)) let items' = compactify items return $ OrderedList (start, style, delim) items' @@ -551,7 +551,8 @@ endline = try $ do -- parse potential list-starts at beginning of line differently in a list: st <- getState if ((stateParserContext st) == ListItemState) - then notFollowedBy' anyOrderedListMarker >> notFollowedBy' bulletListStart + then notFollowedBy (anyOrderedListMarker >> spaceChar) >> + notFollowedBy' bulletListStart else return () return Space |