@@ -232,7 +232,8 @@ para = do
232table :: PandocMonad m => MWParser m Blocks
232table :: PandocMonad m => MWParser m Blocks
233table = do
233table = do
234 tableStart
234 tableStart
235− styles <- option [] parseAttrs
235+ styles <- option [] $
236+ parseAttrs <* skipMany spaceChar <* optional (char '|')
236 skipMany spaceChar
237 skipMany spaceChar
237 optional blanklines
238 optional blanklines
238 let tableWidth = case lookup "width" styles of
239 let tableWidth = case lookup "width" styles of
@@ -283,17 +284,29 @@ rowsep = try $ guardColumnOne *> skipSpaces *> sym "|-" <*
284cellsep :: PandocMonad m => MWParser m ()
285cellsep :: PandocMonad m => MWParser m ()
285cellsep = try $ do
286cellsep = try $ do
287+ col <- sourceColumn <$> getPosition
286 skipSpaces
288 skipSpaces
287− (char '|' *> notFollowedBy (oneOf "-}+") *> optional (char '|'))
291+ notFollowedBy (oneOf "-}+")
288− <|> (char '!' *> optional (char '!'))
292+ if col == 1
293+ then optional (char '|')
294+ else void (char '|')
298+ then optional (char '!')
299+ else void (char '!')
290tableCaption :: PandocMonad m => MWParser m Inlines
302tableCaption :: PandocMonad m => MWParser m Inlines
291tableCaption = try $ do
303tableCaption = try $ do
292 guardColumnOne
304 guardColumnOne
293 skipSpaces
305 skipSpaces
295− optional (try $ parseAttr *> skipSpaces *> char '|' *> skipSpaces)
307+ optional (try $ parseAttr *> skipSpaces *> char '|' *> blanklines)
308+ (trimInlines . mconcat) <$>
296− (trimInlines . mconcat) <$> many (notFollowedBy (cellsep <|> rowsep) *> inline)
309+ many (notFollowedBy (cellsep <|> rowsep) *> inline)
298tableRow :: PandocMonad m => MWParser m [((Alignment, Double), Blocks)]
311tableRow :: PandocMonad m => MWParser m [((Alignment, Double), Blocks)]
299tableRow = try $ skipMany htmlComment *> many tableCell
312tableRow = try $ skipMany htmlComment *> many tableCell