MediaWiki reader: Fixed bug in certain nested lists.

The bug: If a level 2 list was followed by a level 1 list, the first
item of the level 1 list would be lost.

Closes #1213.
This commit is contained in:
John MacFarlane 2014-04-01 10:36:23 -07:00
parent 976f4f2d8f
commit 4ee92dce0c
3 changed files with 9 additions and 1 deletions

View file

@ -438,7 +438,8 @@ listItem c = try $ do
skipMany spaceChar
first <- concat <$> manyTill listChunk newline
rest <- many
(try $ string extras *> (concat <$> manyTill listChunk newline))
(try $ string extras *> lookAhead listStartChar *>
(concat <$> manyTill listChunk newline))
contents <- parseFromString (many1 $ listItem' c)
(unlines (first : rest))
case c of

View file

@ -102,6 +102,10 @@ Pandoc (Meta {unMeta = fromList []})
[[BulletList
[[Plain [Str "But",Space,Str "jumping",Space,Str "levels",Space,Str "creates",Space,Str "empty",Space,Str "space."]]]]]]]
,Para [Str "Any",Space,Str "other",Space,Str "start",Space,Str "ends",Space,Str "the",Space,Str "list."]
,BulletList
[[BulletList
[[Plain [Str "two"]]]]
,[Plain [Str "one"]]]
,OrderedList (1,DefaultStyle,DefaultDelim)
[[Plain [Str "Start",Space,Str "each",Space,Str "line"]]
,[Plain [Str "with",Space,Str "a",Space,Str "number",Space,Str "sign",Space,Str "(#)."]

View file

@ -185,6 +185,9 @@ http://johnmacfarlane.net/pandoc/
*** But jumping levels creates empty space.
Any other start ends the list.
** two
* one
# Start each line
# with a number sign (#).
## More number signs gives deeper