git.iko.soy/typeable/pandoc
on master help sign in
Fixed bug in org with bulleted lists:
46d343fJohn MacFarlane
src/Text/Pandoc/Readers/Org.hs+5−5
@@ -879,18 +879,18 @@ bulletListStart = bulletListStart' Nothing
879
879
880bulletListStart' :: Maybe Int -> OrgParser Int
880bulletListStart' :: Maybe Int -> OrgParser Int
881-- returns length of bulletList prefix, inclusive of marker
881-- 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 '*')
883 oneOf bullets
884 oneOf bullets
884 many1 spaceChar
885 many1 spaceChar
885− return $ length ind + 1
886+ return (ind + 1)
886 -- Unindented lists are legal, but they can't use '*' bullets
887 -- Unindented lists are legal, but they can't use '*' bullets
887 -- We return n to maintain compatibility with the generic listItem
888 -- We return n to maintain compatibility with the generic listItem
888bulletListStart' (Just n) = do count (n-1) spaceChar
889bulletListStart' (Just n) = do count (n-1) spaceChar
889− oneOf validBullets
890+ when (n == 1) $ notFollowedBy (char '*')
891+ oneOf bullets
890 many1 spaceChar
892 many1 spaceChar
891 return n
893 return n
892− where validBullets = if n == 1 then noAsterisks else bullets
893− noAsterisks = filter (/= '*') bullets
894
894
895bullets :: String
895bullets :: String
896bullets = "*+-"
896bullets = "*+-"
tests/Tests/Readers/Org.hs+7
@@ -622,6 +622,13 @@ tests =
622 , plain "Item2"
622 , plain "Item2"
623 ]
623 ]
624
624
625+ , "Unindented *" =:
626+ ("- Item1\n" ++
627+ "* Item2\n") =?>
628+ bulletList [ plain "Item1"
629+ ] <>
630+ header 1 "Item2"
631+
625 , "Multi-line Bullet Lists" =:
632 , "Multi-line Bullet Lists" =:
626 ("- *Fat\n" ++
633 ("- *Fat\n" ++
627 " Tony*\n" ++
634 " Tony*\n" ++