Markdown writer: use raw HTML for simple, pipe tables with linebreaks.
Markdown line breaks involve a newline, and simple and pipe tables can't contain one. Closes #2993.
This commit is contained in:
parent
5fac8266d8
commit
139d418d4b
1 changed files with 5 additions and 1 deletions
|
@ -39,6 +39,7 @@ import Text.Pandoc.Writers.Shared
|
||||||
import Text.Pandoc.Options
|
import Text.Pandoc.Options
|
||||||
import Text.Pandoc.Parsing hiding (blankline, blanklines, char, space)
|
import Text.Pandoc.Parsing hiding (blankline, blanklines, char, space)
|
||||||
import Data.Maybe (fromMaybe)
|
import Data.Maybe (fromMaybe)
|
||||||
|
import Data.Monoid (Any(..))
|
||||||
import Data.List ( group, stripPrefix, find, intersperse, transpose, sortBy )
|
import Data.List ( group, stripPrefix, find, intersperse, transpose, sortBy )
|
||||||
import Data.Char ( isSpace, isPunctuation, ord, chr )
|
import Data.Char ( isSpace, isPunctuation, ord, chr )
|
||||||
import Data.Ord ( comparing )
|
import Data.Ord ( comparing )
|
||||||
|
@ -436,7 +437,10 @@ blockToMarkdown opts t@(Table caption aligns widths headers rows) = do
|
||||||
else blankline <> ": " <> caption' <> blankline
|
else blankline <> ": " <> caption' <> blankline
|
||||||
rawHeaders <- mapM (blockListToMarkdown opts) headers
|
rawHeaders <- mapM (blockListToMarkdown opts) headers
|
||||||
rawRows <- mapM (mapM (blockListToMarkdown opts)) rows
|
rawRows <- mapM (mapM (blockListToMarkdown opts)) rows
|
||||||
let isSimple = all (==0) widths
|
let isLineBreak LineBreak = Any True
|
||||||
|
isLineBreak _ = Any False
|
||||||
|
let isSimple = all (==0) widths &&
|
||||||
|
not ( getAny (query isLineBreak (headers:rows)) )
|
||||||
let isPlainBlock (Plain _) = True
|
let isPlainBlock (Plain _) = True
|
||||||
isPlainBlock _ = False
|
isPlainBlock _ = False
|
||||||
let hasBlocks = not (all isPlainBlock $ concat . concat $ headers:rows)
|
let hasBlocks = not (all isPlainBlock $ concat . concat $ headers:rows)
|
||||||
|
|
Loading…
Add table
Reference in a new issue