diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-27 11:10:15 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-27 11:10:15 -0700 |
commit | 9678538f45258421d12bf12cbf77e7be17f131c3 (patch) | |
tree | 84d57bef75062ede750513bf8be777f511174ebf /src/Text/Pandoc/Readers | |
parent | f5e26e4512c1a797fa3a20cbc451f5d56b248870 (diff) | |
download | pandoc-9678538f45258421d12bf12cbf77e7be17f131c3.tar.gz |
Roff tokenizer: allow digit suffix in table cell format in any order.
Closes #5026.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Roff.hs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Readers/Roff.hs b/src/Text/Pandoc/Readers/Roff.hs index e83821ed4..89c0dd166 100644 --- a/src/Text/Pandoc/Readers/Roff.hs +++ b/src/Text/Pandoc/Readers/Roff.hs @@ -424,23 +424,22 @@ tableColFormat = do $ True <$ (try $ string "|" <* notFollowedBy spacetab) c <- oneOf ['a','A','c','C','l','L','n','N','r','R','s','S','^','_','-', '=','|'] - numsuffixes <- option [] $ (:[]) <$> many1 digit - suffixes <- many $ do - x <- oneOf ['b','B','d','D','e','E','f','F','i','I','m','M', + suffixes <- many $ count 1 digit <|> + (do x <- oneOf ['b','B','d','D','e','E','f','F','i','I','m','M', 'p','P','t','T','u','U','v','V','w','W','x','X', 'z','Z'] - num <- if x == 'w' - then many1 digit <|> - do char '(' - xs <- manyTill anyChar (char ')') - return ("(" ++ xs ++ ")") - else return "" - return $ x : num + num <- if x == 'w' + then many1 digit <|> + do char '(' + xs <- manyTill anyChar (char ')') + return ("(" ++ xs ++ ")") + else return "" + return $ x : num) pipeSuffix' <- option False $ True <$ string "|" return $ CellFormat { columnType = c , pipePrefix = pipePrefix' , pipeSuffix = pipeSuffix' - , columnSuffixes = numsuffixes ++ suffixes } + , columnSuffixes = suffixes } -- We don't fully handle the conditional. But we do -- include everything under '.ie n', which occurs commonly |