diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-12-03 11:02:45 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-12-03 11:02:45 -0800 |
commit | dd8df6cfbc07271f10f380620ecf8867bf3da8c3 (patch) | |
tree | bdaa52587a026471b47378ac4da5ae64d3c39402 /src/Text | |
parent | e5c72caf29026d91a1ae6bae81d2304fecd40d80 (diff) | |
download | pandoc-dd8df6cfbc07271f10f380620ecf8867bf3da8c3.tar.gz |
Markdown reader: Improved pipe table relative widths.
Previously pipe table columns got relative widths (based
on the header underscore lines) when the source of one of the rows was
greater in width than the column width. This gave bad results in some
cases where much of the width of the row was due to nonprinting
material (e.g. link URLs). Now pandoc only looks at printable
width (the width of a plain string version of the source), which
should give better results.
Thanks to John Muccigrosso for bringing up the issue.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 64cd817ba..2d222176c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -1341,10 +1341,10 @@ pipeTable :: MarkdownParser ([Alignment], [Double], F [Blocks], F [[Blocks]]) pipeTable = try $ do nonindentSpaces lookAhead nonspaceChar - ((heads, rawHead),(aligns, seplengths)) <- (,) <$> - withRaw pipeTableRow <*> pipeBreak - (lines', rawRows) <- unzip <$> many (withRaw pipeTableRow) - let maxlength = maximum $ map length (rawHead : rawRows) + (heads,(aligns, seplengths)) <- (,) <$> pipeTableRow <*> pipeBreak + lines' <- many pipeTableRow + let maxlength = maximum $ + map (\x -> length . stringify $ runF x def) (heads : lines') numColumns <- getOption readerColumns let widths = if maxlength > numColumns then map (\len -> |