git.iko.soy/typeable/pandoc
on master help sign in
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>.

commit46d343f47487c330ad5f7ca0f6d97f17bcd4a98a authorJohn MacFarlane <jgm@berkeley.edu> dateThu 13 Nov 2014, 23:40 (12 years ago) parentbd24545
2 files changed+12−5
src/Text/Pandoc/Readers/Org.hs+5−5 tests/Tests/Readers/Org.hs+7
src/Text/Pandoc/Readers/Org.hs+5−5
@@ -879,18 +879,18 @@ bulletListStart = bulletListStart' Nothing
879879
880880bulletListStart' :: Maybe Int -> OrgParser Int
881881-- returns length of bulletList prefix, inclusive of marker
882−bulletListStart' Nothing = do ind <- many spaceChar
882+bulletListStart' Nothing = do ind <- length <$> many spaceChar
883+ when (ind == 0) $ notFollowedBy (char '*')
883884 oneOf bullets
884885 many1 spaceChar
885− return $ length ind + 1
886+ return (ind + 1)
886887 -- Unindented lists are legal, but they can't use '*' bullets
887888 -- We return n to maintain compatibility with the generic listItem
888889bulletListStart' (Just n) = do count (n-1) spaceChar
889− oneOf validBullets
890+ when (n == 1) $ notFollowedBy (char '*')
891+ oneOf bullets
890892 many1 spaceChar
891893 return n
892− where validBullets = if n == 1 then noAsterisks else bullets
893− noAsterisks = filter (/= '*') bullets
894894
895895bullets :: String
896896bullets = "*+-"
tests/Tests/Readers/Org.hs+7
@@ -622,6 +622,13 @@ tests =
622622 , plain "Item2"
623623 ]
624624
625+ , "Unindented *" =:
626+ ("- Item1\n" ++
627+ "* Item2\n") =?>
628+ bulletList [ plain "Item1"
629+ ] <>
630+ header 1 "Item2"
631+
625632 , "Multi-line Bullet Lists" =:
626633 ("- *Fat\n" ++
627634 " Tony*\n" ++