git.iko.soy/typeable/pandoc
on master help sign in
Muse reader: fix parsing of empty cells
commitd3b2161bd17c25358422f84d282f4688c345a879 authorAlexander Krotov <ilabdsf@gmail.com> dateWed 10 Oct 2018, 01:48 (8 years ago) parent7556dc9
2 files changed+12−1
src/Text/Pandoc/Readers/Muse.hs+1−1 test/Tests/Readers/Muse.hs+11
src/Text/Pandoc/Readers/Muse.hs+1−1
@@ -703,7 +703,7 @@ tableParseRow :: PandocMonad m
703703tableParseRow n = try $ sequence <$> tableCells
704704 where tableCells = (:) <$> tableCell sep <*> (tableCells <|> fmap pure (tableCell eol))
705705 tableCell p = try $ fmap B.plain . trimInlinesF . mconcat <$> manyTill inline' p
706− sep = try $ many1 spaceChar *> count n (char '|') *> (void (many1 spaceChar) <|> void (lookAhead eol))
706+ sep = try $ many1 spaceChar *> count n (char '|') *> (void (lookAhead $ many1 spaceChar) <|> void (lookAhead eol))
707707
708708-- | Parse a table header row.
709709tableParseHeader :: PandocMonad m => MuseParser m (F MuseTableElement)
test/Tests/Readers/Muse.hs+11
@@ -891,6 +891,17 @@ tests =
891891 [[plain "", plain "Foo"],
892892 [plain "", plain ""],
893893 [plain "bar", plain ""]]
894+ , "Empty cell in the middle" =:
895+ T.unlines
896+ [ " 1 | 2 | 3"
897+ , " 4 | | 6"
898+ , " 7 | 8 | 9"
899+ ] =?>
900+ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0), (AlignDefault, 0.0)]
901+ []
902+ [[plain "1", plain "2", plain "3"],
903+ [plain "4", mempty, plain "6"],
904+ [plain "7", plain "8", plain "9"]]
894905 ]
895906 , testGroup "Lists"
896907 [ "Bullet list" =: