Markdown reader: Allow hard line breaks in table cells.

The \-newline form must be used; the two-space+newline form
won't work, since in a table cell nearly every line ends with
two spaces.
This commit is contained in:
John MacFarlane 2014-01-07 23:39:49 -08:00
parent 3cad665afb
commit d9eff99f27

View file

@ -1126,12 +1126,12 @@ multilineTableHeader headless = try $ do
then liftM (map (:[]) . tail .
splitStringByIndices (init indices)) $ lookAhead anyLine
else return $ transpose $ map
(\ln -> tail $ splitStringByIndices (init indices) ln)
(tail . splitStringByIndices (init indices))
rawContent
let aligns = zipWith alignType rawHeadsList lengths
let rawHeads = if headless
then replicate (length dashes) ""
else map unwords rawHeadsList
else map (unlines . map trim) rawHeadsList
heads <- fmap sequence $
mapM (parseFromString (mconcat <$> many plain)) $
map trim rawHeads
@ -1188,7 +1188,7 @@ gridTableHeader headless = try $ do
-- RST does not have a notion of alignments
let rawHeads = if headless
then replicate (length dashes) ""
else map unwords $ transpose
else map (unlines . map trim) $ transpose
$ map (gridTableSplitLine indices) rawContent
heads <- fmap sequence $ mapM (parseFromString parseBlocks . trim) rawHeads
return (heads, aligns, indices)