git.iko.soy/typeable/pandoc
on master help sign in
DocBook reader: Fixed headers for headerless table.
commitb1cba4ae8e3380e711a850256eb29063c8d91844 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 8 May 2012, 21:44 (14 years ago) parentf1869a0
1 file changed+7−5
src/Text/Pandoc/Readers/DocBook.hs+7−5
src/Text/Pandoc/Readers/DocBook.hs+7−5
@@ -10,7 +10,7 @@ import Data.Monoid
1010import Data.Char (isSpace)
1111import Control.Monad.State
1212import Control.Applicative ((<$>))
13−import Data.List (intersperse)
13+import Data.List (intersperse, transpose)
1414
1515{-
1616
@@ -698,14 +698,16 @@ parseBlock (Elem e) =
698698 Just "right" -> AlignRight
699699 Just "center" -> AlignCenter
700700 _ -> AlignDefault
701+ let numrows = maximum $ map length bodyrows
701702 let aligns = case colspecs of
702− [] -> replicate
703− (maximum $ map length bodyrows)
704− AlignDefault
703+ [] -> replicate numrows AlignDefault
705704 cs -> map toAlignment cs
705+ let headrows' = if null headrows
706+ then replicate numrows mempty
707+ else headrows
706708 return $ table caption
707709 (zip aligns (repeat 0))
708− headrows bodyrows
710+ headrows' bodyrows
709711 isEntry x = named "entry" x || named "td" x || named "th" x
710712 parseRow = mapM getBlocks . filterChildren isEntry
711713 sect n = do isbook <- gets dbBook