Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Latex Reader] Table cell parser not consuming spaces correctly #6597

Merged
merged 2 commits into from
Aug 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Text/Pandoc/Readers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2387,9 +2387,11 @@ parseTableRow envname prefsufs = do

parseTableCell :: PandocMonad m => LP m Cell
parseTableCell = do
spaces
updateState $ \st -> st{ sInTableCell = True }
cell' <- parseMultiCell <|> parseSimpleCell
updateState $ \st -> st{ sInTableCell = False }
spaces
return cell'

cellAlignment :: PandocMonad m => LP m Alignment
Expand Down
7 changes: 7 additions & 0 deletions test/Tests/Readers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ tests = [ testGroup "tokenization"
, simpleCell (plain "Two")
]
]
, "table with multicolumn item (#6596)" =:
"\\begin{tabular}{l c r}One & \\multicolumn{2}{c}{Two} & \\\\ \\end{tabular}" =?>
table' [AlignLeft, AlignCenter, AlignRight]
[ Row nullAttr [ simpleCell (plain "One")
, cell AlignCenter (RowSpan 1) (ColSpan 2) (plain "Two")
]
]
, "Table with multirow item" =:
T.unlines ["\\begin{tabular}{c}"
,"\\multirow{2}{c}{One}\\\\Two\\\\"
Expand Down