git.iko.soy/typeable/pandoc
on master help sign in
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.)

commit444485d62cfe136c638c0fde1902c1149f67b971 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 25 Oct 2018, 22:35 (8 years ago) parente752e3d
1 file changed+4−3
src/Text/Pandoc/Readers/Man.hs+4−3
src/Text/Pandoc/Readers/Man.hs+4−3
@@ -34,6 +34,7 @@ Conversion of man to 'Pandoc' document.
3434module Text.Pandoc.Readers.Man (readMan) where
3535
3636import Prelude
37+import Safe (lastMay)
3738import Data.Char (toLower)
3839import Data.Default (Default)
3940import Control.Monad (liftM, mzero, guard)
@@ -114,8 +115,8 @@ parseTable = do
114115 let isMTable (MTable{}) = True
115116 isMTable _ = False
116117 MTable _opts aligns rows pos <- msatisfy isMTable
117− case aligns of
118− [as] -> try (do
118+ case lastMay aligns of
119+ Just as -> try (do
119120 let as' = map (columnTypeToAlignment . columnType) as
120121 guard $ all isJust as'
121122 let alignments = catMaybes as'
@@ -128,7 +129,7 @@ parseTable = do
128129 bodyRows <- mapM (mapM parseTableCell) bodyRows'
129130 return $ B.table mempty (zip alignments (repeat 0.0))
130131 headerRow bodyRows) <|> fallback pos
131− _ -> fallback pos
132+ Nothing -> fallback pos
132133
133134 where
134135