diff --git a/src/Text/Pandoc/Readers/DokuWiki.hs b/src/Text/Pandoc/Readers/DokuWiki.hs index 78c29c482..010fb2639 100644 --- a/src/Text/Pandoc/Readers/DokuWiki.hs +++ b/src/Text/Pandoc/Readers/DokuWiki.hs @@ -528,10 +528,11 @@ tableRows :: PandocMonad m => DWParser m [[(Alignment, B.Blocks)]] tableRows = many1 tableRow tableRow :: PandocMonad m => DWParser m [(Alignment, B.Blocks)] -tableRow = many1Till tableCell tableRowEnd +tableRow = tableCellSeparator *> many1 tableCell <* tableRowEnd -tableRowEnd :: PandocMonad m => DWParser m Char -tableRowEnd = try $ tableCellSeparator <* manyTill spaceChar eol +-- DokuWiki just ignores stuff after the end of a table row (#11739) +tableRowEnd :: PandocMonad m => DWParser m () +tableRowEnd = void $ manyTill anyChar eol tableCellSeparator :: PandocMonad m => DWParser m Char tableCellSeparator = char '|' <|> char '^' @@ -542,8 +543,7 @@ tableCell = try $ (second (B.plain . B.trimInlines . mconcat)) <$> cellContent cellContent = do -- https://www.dokuwiki.org/wiki:syntax#tables -- DokuWiki represents the alignment of cells with two spaces padding. - tableCellSeparator - cellInline <- manyTill inlineUnconsolidatedWhitespace (lookAhead tableCellSeparator) + cellInline <- manyTill inlineUnconsolidatedWhitespace tableCellSeparator let left = [B.space, B.space] `isPrefixOf` cellInline let right = [B.space, B.space] `isSuffixOf` cellInline let alignment = case (left, right) of diff --git a/test/command/11739.md b/test/command/11739.md new file mode 100644 index 000000000..2fca62608 --- /dev/null +++ b/test/command/11739.md @@ -0,0 +1,40 @@ +``` +% pandoc -f dokuwiki -t native +| a | extra stuff +| b | extra stuff +after +^D +[ Table + ( "" , [] , [] ) + (Caption Nothing []) + [ ( AlignDefault , ColWidthDefault ) ] + (TableHead ( "" , [] , [] ) []) + [ TableBody + ( "" , [] , [] ) + (RowHeadColumns 0) + [] + [ Row + ( "" , [] , [] ) + [ Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "a" ] ] + ] + , Row + ( "" , [] , [] ) + [ Cell + ( "" , [] , [] ) + AlignDefault + (RowSpan 1) + (ColSpan 1) + [ Plain [ Str "b" ] ] + ] + ] + ] + (TableFoot ( "" , [] , [] ) []) +, Para [ Str "after" ] +] + +```