mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
@@ -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
|
||||
|
||||
@@ -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" ]
|
||||
]
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user