Creole reader: fixed lists with trailing white space.
This commit is contained in:
parent
a496979c6d
commit
fa67d6e86f
2 changed files with 12 additions and 1 deletions
|
@ -154,7 +154,8 @@ listItem :: PandocMonad m => Char -> Int -> CRLParser m B.Blocks
|
|||
listItem c n =
|
||||
fmap (B.plain . B.trimInlines .mconcat) (listStart >> many1Till inline itemEnd)
|
||||
where
|
||||
listStart = try $ optional newline >> skipSpaces >> count n (char c)
|
||||
listStart = try $ skipSpaces >> optional newline >> skipSpaces
|
||||
>> count n (char c)
|
||||
>> lookAhead (noneOf [c]) >> skipSpaces
|
||||
itemEnd = endOfParaElement <|> nextItem n
|
||||
<|> if n < 3 then nextItem (n+1)
|
||||
|
|
|
@ -127,6 +127,11 @@ tests = [
|
|||
=?> bulletList [ plain "foo"
|
||||
<> bulletList [ plain "bar", plain "baz" ]
|
||||
, plain "blubb" ]
|
||||
, "nested unordered list, one separating space, trailing space" =:
|
||||
"* foo \n** bar \n** baz \n* blubb "
|
||||
=?> bulletList [ plain "foo"
|
||||
<> bulletList [ plain "bar", plain "baz" ]
|
||||
, plain "blubb" ]
|
||||
, "ordered list, two entries, one separating space" =:
|
||||
"# foo\n# bar"
|
||||
=?> orderedList [ plain "foo", plain "bar" ]
|
||||
|
@ -141,6 +146,11 @@ tests = [
|
|||
=?> orderedList [ plain "foo"
|
||||
<> orderedList [ plain "bar", plain "baz" ]
|
||||
, plain "blubb" ]
|
||||
, "nested ordered list, one separating space, trailing space" =:
|
||||
"# foo \n## bar \n## baz \n# blubb "
|
||||
=?> orderedList [ plain "foo"
|
||||
<> orderedList [ plain "bar", plain "baz" ]
|
||||
, plain "blubb" ]
|
||||
, "nested many ordered lists, one separating space" =:
|
||||
("# foo\n## bar\n### third\n### third two\n## baz\n### third again\n"
|
||||
<> "#### fourth\n##### fith\n# blubb")
|
||||
|
|
Loading…
Reference in a new issue