mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-26 09:25:48 +00:00
LaTeX reader: allow non-empty colsep in tables
The `tabular` environment allows non-empty column separators
with the "@{...}" syntax. Previously, pandoc would fail to
parse tables if a non-empty colsep was present. With this
commit, these separators are still ignored, but the table gets
parsed. A test case is included.
This commit is contained in:
@@ -1275,7 +1275,7 @@ complexNatbibCitation mode = try $ do
|
||||
parseAligns :: LP [Alignment]
|
||||
parseAligns = try $ do
|
||||
char '{'
|
||||
let maybeBar = skipMany $ sp <|> () <$ char '|' <|> () <$ try (string "@{}")
|
||||
let maybeBar = skipMany $ sp <|> () <$ char '|' <|> () <$ (char '@' >> braced)
|
||||
maybeBar
|
||||
let cAlign = AlignCenter <$ char 'c'
|
||||
let lAlign = AlignLeft <$ char 'l'
|
||||
|
||||
@@ -91,6 +91,11 @@ tests = [ testGroup "basic"
|
||||
, "Table with empty column separators" =:
|
||||
"\\begin{tabular}{@{}r@{}l}One & Two\\\\ \\end{tabular}" =?>
|
||||
simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]]
|
||||
, "Table with custom column separators" =:
|
||||
unlines [ "\\begin{tabular}{@{($\\to$)}r@{\\hspace{2cm}}l}"
|
||||
, "One&Two\\\\"
|
||||
, "\\end{tabular}" ] =?>
|
||||
simpleTable' [AlignRight,AlignLeft] [[plain "One", plain "Two"]]
|
||||
, "Table with vertical alignment argument" =:
|
||||
"\\begin{tabular}[t]{r|r}One & Two\\\\ \\end{tabular}" =?>
|
||||
simpleTable' [AlignRight,AlignRight] [[plain "One", plain "Two"]]
|
||||
|
||||
Reference in New Issue
Block a user