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

commite7187fa3bb5e704b8a4a96f8de952636de4eee3e authorJohn MacFarlane <jgm@berkeley.edu> dateThu 1 Jan 2015, 08:46 (12 years ago) parent52310eb
1 file changed+5−3
src/Text/Pandoc/Readers/LaTeX.hs+5−3
src/Text/Pandoc/Readers/LaTeX.hs+5−3
@@ -1018,7 +1018,8 @@ environments = M.fromList
10181018 , ("center", env "center" blocks)
10191019 , ("table", env "table" $
10201020 resetCaption *> skipopts *> blocks >>= addTableCaption)
1021− , ("tabular", env "tabular" simpTable)
1021+ , ("tabular*", env "tabular" $ simpTable True)
1022+ , ("tabular", env "tabular" $ simpTable False)
10221023 , ("quote", blockQuote <$> env "quote" blocks)
10231024 , ("quotation", blockQuote <$> env "quotation" blocks)
10241025 , ("verse", blockQuote <$> env "verse" blocks)
@@ -1304,8 +1305,9 @@ parseTableRow cols = try $ do
13041305 spaces
13051306 return cells''
13061307
1307−simpTable :: LP Blocks
1308−simpTable = try $ do
1308+simpTable :: Bool -> LP Blocks
1309+simpTable hasWidthParameter = try $ do
1310+ when hasWidthParameter $ () <$ (spaces >> tok)
13091311 spaces
13101312 aligns <- parseAligns
13111313 let cols = length aligns