Markdown reader tables: Fixed bug in alignments.
Previously pandoc got confused by blank rows in the header.
This commit is contained in:
parent
caa091e810
commit
8a3fd7606f
1 changed files with 5 additions and 4 deletions
|
@ -869,10 +869,11 @@ alignType :: [String]
|
|||
-> Alignment
|
||||
alignType [] _ = AlignDefault
|
||||
alignType strLst len =
|
||||
let s = head $ sortBy (comparing length) $
|
||||
map removeTrailingSpace strLst
|
||||
leftSpace = if null s then False else (s !! 0) `elem` " \t"
|
||||
rightSpace = length s < len || (s !! (len - 1)) `elem` " \t"
|
||||
let nonempties = filter (not . null) $ map removeTrailingSpace strLst
|
||||
(leftSpace, rightSpace) =
|
||||
case sortBy (comparing length) nonempties of
|
||||
(x:_) -> (head x `elem` " \t", length x < len)
|
||||
[] -> (False, False)
|
||||
in case (leftSpace, rightSpace) of
|
||||
(True, False) -> AlignRight
|
||||
(False, True) -> AlignLeft
|
||||
|
|
Loading…
Add table
Reference in a new issue