git.iko.soy/typeable/pandoc
on master help sign in
Man reader: table improvements.
commit2f6e4ba84ab1ed09234b21e354a522ae28cf4da6 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 2 Nov 2018, 23:38 (8 years ago) parent2843ee9
1 file changed+7−6
src/Text/Pandoc/Readers/Roff.hs+7−6
src/Text/Pandoc/Readers/Roff.hs+7−6
@@ -396,7 +396,7 @@ lexTable :: PandocMonad m => SourcePos -> RoffLexer m RoffTokens
396396lexTable pos = do
397397 skipMany lexComment
398398 spaces
399− opts <- option [] $ try $ tableOptions <* char ';'
399+ opts <- try tableOptions <|> [] <$ optional (char ';')
400400 case lookup "tab" opts of
401401 Just (c:_) -> modifyState $ \st -> st{ tableTabChar = c }
402402 _ -> modifyState $ \st -> st{ tableTabChar = '\t' }
@@ -448,7 +448,7 @@ tableRow = do
448448 return (c:cs)
449449
450450tableOptions :: PandocMonad m => RoffLexer m [TableOption]
451−tableOptions = many tableOption <* spaces
451+tableOptions = many1 tableOption <* spaces <* char ';'
452452
453453tableOption :: PandocMonad m => RoffLexer m TableOption
454454tableOption = do
@@ -472,7 +472,7 @@ tableFormatSpec = do
472472
473473tableFormatSpecLine :: PandocMonad m => RoffLexer m [CellFormat]
474474tableFormatSpecLine =
475− many1 $ try $ skipMany spacetab *> tableColFormat <* skipMany spacetab
475+ many1 $ skipMany spacetab *> tableColFormat <* skipMany spacetab
476476
477477tableColFormat :: PandocMonad m => RoffLexer m CellFormat
478478tableColFormat = do
@@ -485,9 +485,10 @@ tableColFormat = do
485485 'p','P','t','T','u','U','v','V','w','W','x','X', 'z','Z']
486486 num <- case toLower x of
487487 'w' -> many1 digit <|>
488− do char '('
489− xs <- manyTill anyChar (char ')')
490− return ("(" ++ xs ++ ")")
488+ (do char '('
489+ xs <- manyTill anyChar (char ')')
490+ return ("(" ++ xs ++ ")")) <|>
491+ return ""
491492 'f' -> count 1 alphaNum <* skipMany spacetab
492493 'm' -> count 1 alphaNum <* skipMany spacetab
493494 _ -> return ""