@@ -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