@@ -171,7 +171,7 @@ table = do
171171 rows' <- many $ try $ rowsep *> tableRow
172172 tableEnd
173173 -- TODO handle cellspecs from styles and aligns...
174− let cols = length $ head rows'
174+ let cols = length hdr
175175 let (headers,rows) = if hasheader
176176 then (hdr, rows')
177177 else (replicate cols mempty, hdr:rows')
@@ -197,11 +197,12 @@ tableCaption = try $ guardColumnOne *> sym "|+" *> skipMany spaceChar *>
197197 (trimInlines . mconcat <$> (many inline)) <* skipMany blankline
198198
199199tableRow :: MWParser [Blocks]
200−tableRow = try $ many tableCell <* skipMany blankline
200+tableRow = try $ many tableCell
201201
202202tableCell :: MWParser Blocks
203203tableCell =
204− try $ cellsep *> skipMany spaceChar *> (mconcat <$> (many block))
204+ try $ cellsep *> skipMany spaceChar *>
205+ (mconcat <$> (many $ notFollowedBy (cellsep <|> rowsep <|> tableEnd) *> block))
205206
206207template :: MWParser Blocks
207208template = B.rawBlock "mediawiki" <$> doublebrackets
@@ -405,7 +406,9 @@ inlineTag = do
405406
406407special :: MWParser Inlines
407408special = B.str <$> count 1 (notFollowedBy' (htmlTag isBlockTag') *>
408− notFollowedBy (char '|') *> oneOf specialChars)
409+-- notFollowedBy (tableStart <|> tableEnd
410+-- <|> cellsep <|> rowsep) *>
411+ oneOf specialChars)
409412
410413inlineHtml :: MWParser Inlines
411414inlineHtml = B.rawInline "html" . snd <$> htmlTag isInlineTag
@@ -418,8 +421,10 @@ endline = () <$ try (newline <*
418421 notFollowedBy blankline <*
419422 notFollowedBy' hrule <*
420423 notFollowedBy tableStart <*
424+ notFollowedBy tableEnd <*
421425 notFollowedBy' template <*
422426 notFollowedBy cellsep <*
427+ notFollowedBy rowsep <*
423428 notFollowedBy anyListStart)
424429
425430image :: MWParser Inlines