Man reader: allow empty simple table cells.

This commit is contained in:
John MacFarlane 2018-10-25 22:53:48 -07:00
parent 1ee594bf0e
commit 23ca15e7ad
2 changed files with 5 additions and 3 deletions

View file

@ -356,7 +356,7 @@ tableCell = (enclosedCell <|> simpleCell) >>= lexGroff . T.pack
manyTill anyChar (try (string "T}"))
simpleCell = do
tabChar <- tableTabChar <$> getState
many1 (notFollowedBy (char tabChar <|> newline) >> anyChar)
many (notFollowedBy (char tabChar <|> newline) >> anyChar)
tableRow :: PandocMonad m => GroffLexer m [GroffTokens]
tableRow = do

View file

@ -136,10 +136,12 @@ parseTable = do
parseTableCell ts = do
st <- getState
let ts' = Foldable.toList $ unGroffTokens ts
let tcell = do
let tcell = try $ do
skipMany memptyLine
plain . trimInlines <$> (parseInlines <* eof)
res <- lift $ readWithMTokens tcell st ts'
res <- if null ts'
then return $ Right mempty
else lift $ readWithMTokens tcell st ts'
case res of
Left e -> throwError e
Right x -> return x