git.iko.soy/typeable/pandoc
on master help sign in
Parsing: Fixed bug in grid table parser.
ba1d0d3John MacFarlane
src/Text/Pandoc/Parsing.hs+5−5
@@ -488,8 +488,8 @@ gridTableWith block tableCaption headless =
488 tableWith (gridTableHeader headless block) (gridTableRow block) (gridTableSep '-') gridTableFooter tableCaption
488 tableWith (gridTableHeader headless block) (gridTableRow block) (gridTableSep '-') gridTableFooter tableCaption
489
489
490gridTableSplitLine :: [Int] -> String -> [String]
490gridTableSplitLine :: [Int] -> String -> [String]
491−gridTableSplitLine indices line =
491+gridTableSplitLine indices line = map removeFinalBar $ tail $
492− map removeFinalBar $ tail $ splitByIndices (init indices) line
492+ splitByIndices (init indices) $ removeTrailingSpace line
493
493
494gridPart :: Char -> GenParser Char st (Int, Int)
494gridPart :: Char -> GenParser Char st (Int, Int)
495gridPart ch = do
495gridPart ch = do
@@ -501,8 +501,8 @@ gridDashedLines :: Char -> GenParser Char st [(Int,Int)]
501gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) >>~ blankline
501gridDashedLines ch = try $ char '+' >> many1 (gridPart ch) >>~ blankline
502
502
503removeFinalBar :: String -> String
503removeFinalBar :: String -> String
504−removeFinalBar = reverse . dropWhile (=='|') . dropWhile (`elem` " \t") .
504+removeFinalBar =
505− reverse
505+ reverse . dropWhile (`elem` " \t") . dropWhile (=='|') . reverse
506
506
507-- | Separator between rows of grid table.
507-- | Separator between rows of grid table.
508gridTableSep :: Char -> GenParser Char ParserState Char
508gridTableSep :: Char -> GenParser Char ParserState Char
@@ -539,7 +539,7 @@ gridTableRawLine :: [Int] -> GenParser Char ParserState [String]
539gridTableRawLine indices = do
539gridTableRawLine indices = do
540 char '|'
540 char '|'
541 line <- many1Till anyChar newline
541 line <- many1Till anyChar newline
542− return (gridTableSplitLine indices $ removeTrailingSpace line)
542+ return (gridTableSplitLine indices line)
543
543
544-- | Parse row of grid table.
544-- | Parse row of grid table.
545gridTableRow :: GenParser Char ParserState Block
545gridTableRow :: GenParser Char ParserState Block