aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Man.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-25 22:35:55 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-25 22:35:55 -0700
commit444485d62cfe136c638c0fde1902c1149f67b971 (patch)
treeb26aadd7d051019fab650b300db59a24b9783331 /src/Text/Pandoc/Readers/Man.hs
parente752e3d3c7ab2afff60d0cc9775ea057b4025739 (diff)
downloadpandoc-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/Man.hs')
-rw-r--r--src/Text/Pandoc/Readers/Man.hs7
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