git.iko.soy/typeable/pandoc
on master help sign in
[Latex Reader] Table cell parser not consuming spaces correctly (#6597)
499fc11Laurent P. René de Cotret
src/Text/Pandoc/Readers/LaTeX.hs+2
@@ -2387,9 +2387,11 @@ parseTableRow envname prefsufs = do
2387
2387
2388parseTableCell :: PandocMonad m => LP m Cell
2388parseTableCell :: PandocMonad m => LP m Cell
2389parseTableCell = do
2389parseTableCell = do
2390+ spaces
2390 updateState $ \st -> st{ sInTableCell = True }
2391 updateState $ \st -> st{ sInTableCell = True }
2391 cell' <- parseMultiCell <|> parseSimpleCell
2392 cell' <- parseMultiCell <|> parseSimpleCell
2392 updateState $ \st -> st{ sInTableCell = False }
2393 updateState $ \st -> st{ sInTableCell = False }
2394+ spaces
2393 return cell'
2395 return cell'
2394
2396
2395cellAlignment :: PandocMonad m => LP m Alignment
2397cellAlignment :: PandocMonad m => LP m Alignment
test/Tests/Readers/LaTeX.hs+7
@@ -148,6 +148,13 @@ tests = [ testGroup "tokenization"
148 , simpleCell (plain "Two")
148 , simpleCell (plain "Two")
149 ]
149 ]
150 ]
150 ]
151+ , "table with multicolumn item (#6596)" =:
152+ "\\begin{tabular}{l c r}One & \\multicolumn{2}{c}{Two} & \\\\ \\end{tabular}" =?>
153+ table' [AlignLeft, AlignCenter, AlignRight]
154+ [ Row nullAttr [ simpleCell (plain "One")
155+ , cell AlignCenter (RowSpan 1) (ColSpan 2) (plain "Two")
156+ ]
157+ ]
151 , "Table with multirow item" =:
158 , "Table with multirow item" =:
152 T.unlines ["\\begin{tabular}{c}"
159 T.unlines ["\\begin{tabular}{c}"
153 ,"\\multirow{2}{c}{One}\\\\Two\\\\"
160 ,"\\multirow{2}{c}{One}\\\\Two\\\\"