aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-01 08:46:45 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-01 08:46:45 -0800
commite7187fa3bb5e704b8a4a96f8de952636de4eee3e (patch)
treea804ddacaccb739cee4f4f35bec12d53f508a2f3 /src
parent52310eb4708f0737ad87ac5f1217571b3dc73a78 (diff)
downloadpandoc-e7187fa3bb5e704b8a4a96f8de952636de4eee3e.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs8
1 files changed, 5 insertions, 3 deletions
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