From 444485d62cfe136c638c0fde1902c1149f67b971 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 25 Oct 2018 22:35:55 -0700 Subject: 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.) --- src/Text/Pandoc/Readers/Man.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') 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 -- cgit v1.2.3