Fixed bug in org with bulleted lists:
- a - b * c was being parsed as a list, even though an unindented `*` should make a heading. See <http://orgmode.org/manual/Plain-lists.html#fn-1>.
This commit is contained in:
parent
bd245450c4
commit
46d343f474
2 changed files with 12 additions and 5 deletions
|
@ -879,18 +879,18 @@ bulletListStart = bulletListStart' Nothing
|
|||
|
||||
bulletListStart' :: Maybe Int -> OrgParser Int
|
||||
-- returns length of bulletList prefix, inclusive of marker
|
||||
bulletListStart' Nothing = do ind <- many spaceChar
|
||||
bulletListStart' Nothing = do ind <- length <$> many spaceChar
|
||||
when (ind == 0) $ notFollowedBy (char '*')
|
||||
oneOf bullets
|
||||
many1 spaceChar
|
||||
return $ length ind + 1
|
||||
return (ind + 1)
|
||||
-- Unindented lists are legal, but they can't use '*' bullets
|
||||
-- We return n to maintain compatibility with the generic listItem
|
||||
bulletListStart' (Just n) = do count (n-1) spaceChar
|
||||
oneOf validBullets
|
||||
when (n == 1) $ notFollowedBy (char '*')
|
||||
oneOf bullets
|
||||
many1 spaceChar
|
||||
return n
|
||||
where validBullets = if n == 1 then noAsterisks else bullets
|
||||
noAsterisks = filter (/= '*') bullets
|
||||
|
||||
bullets :: String
|
||||
bullets = "*+-"
|
||||
|
|
|
@ -622,6 +622,13 @@ tests =
|
|||
, plain "Item2"
|
||||
]
|
||||
|
||||
, "Unindented *" =:
|
||||
("- Item1\n" ++
|
||||
"* Item2\n") =?>
|
||||
bulletList [ plain "Item1"
|
||||
] <>
|
||||
header 1 "Item2"
|
||||
|
||||
, "Multi-line Bullet Lists" =:
|
||||
("- *Fat\n" ++
|
||||
" Tony*\n" ++
|
||||
|
|
Loading…
Reference in a new issue