diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2022-02-13 13:06:49 -0800 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2022-02-13 13:06:49 -0800 |
| commit | 85136b064fa014a33960b4b34af6de80804db2dc (patch) | |
| tree | b7b66b5b03a2f541d73532987fcdd1d9e4a80138 /src | |
| parent | 495ae605e3238d02a7e5e3b5be6a43b50ce5e492 (diff) | |
Markdown reader: allow one-column pipe tables with pipe on right.
See #7919.
We still need to implement this for gfm (commonmark).
This must be done via changes in commonmark-hs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index ac6be7729..25318f0f4 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1364,9 +1364,9 @@ pipeBreak = try $ do openPipe <- (True <$ char '|') <|> return False first <- pipeTableHeaderPart rest <- many $ sepPipe *> pipeTableHeaderPart - -- surrounding pipes needed for a one-column table: - guard $ not (null rest && not openPipe) - optional (char '|') + closePipe <- (True <$ char '|') <|> return False + -- at least one pipe needed for a one-column table: + guard $ not (null rest && not (openPipe || closePipe)) blankline return $ unzip (first:rest) @@ -1406,9 +1406,10 @@ pipeTableRow = try $ do -- split into cells let chunk = void (code <|> math <|> rawHtmlInline <|> escapedChar <|> rawLaTeXInline') <|> void (noneOf "|\n\r") - cells <- (snd <$> withRaw (many chunk)) `sepEndBy1` char '|' - -- surrounding pipes needed for a one-column table: - guard $ not (length cells == 1 && not openPipe) + cells <- (snd <$> withRaw (many chunk)) `sepBy1` char '|' + closePipe <- (True <$ char '|') <|> return False + -- at least one pipe needed for a one-column table: + guard $ not (length cells == 1 && not (openPipe || closePipe)) blankline return cells |
