diff options
author | John MacFarlane <jgm@berkeley.edu> | 2018-10-25 22:35:55 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2018-10-25 22:35:55 -0700 |
commit | 444485d62cfe136c638c0fde1902c1149f67b971 (patch) | |
tree | b26aadd7d051019fab650b300db59a24b9783331 /src/Text/Pandoc/Readers | |
parent | e752e3d3c7ab2afff60d0cc9775ea057b4025739 (diff) | |
download | pandoc-444485d62cfe136c638c0fde1902c1149f67b971.tar.gz |
Man reader: be more forgiving when parsing tables.
We now look only at the last row of the format specifiers,
if there is more than one row. (This is the default.)
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Man.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Man.hs b/src/Text/Pandoc/Readers/Man.hs index 6f3a1a78d..e0440ec61 100644 --- a/src/Text/Pandoc/Readers/Man.hs +++ b/src/Text/Pandoc/Readers/Man.hs @@ -34,6 +34,7 @@ Conversion of man to 'Pandoc' document. module Text.Pandoc.Readers.Man (readMan) where import Prelude +import Safe (lastMay) import Data.Char (toLower) import Data.Default (Default) import Control.Monad (liftM, mzero, guard) @@ -114,8 +115,8 @@ parseTable = do let isMTable (MTable{}) = True isMTable _ = False MTable _opts aligns rows pos <- msatisfy isMTable - case aligns of - [as] -> try (do + case lastMay aligns of + Just as -> try (do let as' = map (columnTypeToAlignment . columnType) as guard $ all isJust as' let alignments = catMaybes as' @@ -128,7 +129,7 @@ parseTable = do bodyRows <- mapM (mapM parseTableCell) bodyRows' return $ B.table mempty (zip alignments (repeat 0.0)) headerRow bodyRows) <|> fallback pos - _ -> fallback pos + Nothing -> fallback pos where |