From e7187fa3bb5e704b8a4a96f8de952636de4eee3e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 1 Jan 2015 08:46:45 -0800 Subject: LaTeX reader: handle `tabular*` environment. This change allows pandoc not to choke on the table-width parameter of `tabular*`. Note that the table width is not actually parsed or taken into account, but this should give tolerable results in many cases. Closes #1850. --- src/Text/Pandoc/Readers/LaTeX.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Text') diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs index 97a4e1225..8b3743bca 100644 --- a/src/Text/Pandoc/Readers/LaTeX.hs +++ b/src/Text/Pandoc/Readers/LaTeX.hs @@ -1018,7 +1018,8 @@ environments = M.fromList , ("center", env "center" blocks) , ("table", env "table" $ resetCaption *> skipopts *> blocks >>= addTableCaption) - , ("tabular", env "tabular" simpTable) + , ("tabular*", env "tabular" $ simpTable True) + , ("tabular", env "tabular" $ simpTable False) , ("quote", blockQuote <$> env "quote" blocks) , ("quotation", blockQuote <$> env "quotation" blocks) , ("verse", blockQuote <$> env "verse" blocks) @@ -1304,8 +1305,9 @@ parseTableRow cols = try $ do spaces return cells'' -simpTable :: LP Blocks -simpTable = try $ do +simpTable :: Bool -> LP Blocks +simpTable hasWidthParameter = try $ do + when hasWidthParameter $ () <$ (spaces >> tok) spaces aligns <- parseAligns let cols = length aligns -- cgit v1.2.3