@@ -10,7 +10,7 @@ import Data.Monoid
10import Data.Char (isSpace)
10import Data.Char (isSpace)
11import Control.Monad.State
11import Control.Monad.State
12import Control.Applicative ((<$>))
12import Control.Applicative ((<$>))
13−import Data.List (intersperse)
13+import Data.List (intersperse, transpose)
@@ -698,14 +698,16 @@ parseBlock (Elem e) =
698 Just "right" -> AlignRight
698 Just "right" -> AlignRight
699 Just "center" -> AlignCenter
699 Just "center" -> AlignCenter
700 _ -> AlignDefault
700 _ -> AlignDefault
701+ let numrows = maximum $ map length bodyrows
701 let aligns = case colspecs of
702 let aligns = case colspecs of
703− (maximum $ map length bodyrows)
704− AlignDefault
703+ [] -> replicate numrows AlignDefault
705 cs -> map toAlignment cs
704 cs -> map toAlignment cs
705+ let headrows' = if null headrows
706+ then replicate numrows mempty
706 return $ table caption
708 return $ table caption
707 (zip aligns (repeat 0))
709 (zip aligns (repeat 0))
708− headrows bodyrows
710+ headrows' bodyrows
709 isEntry x = named "entry" x || named "td" x || named "th" x
711 isEntry x = named "entry" x || named "td" x || named "th" x
710 parseRow = mapM getBlocks . filterChildren isEntry
712 parseRow = mapM getBlocks . filterChildren isEntry
711 sect n = do isbook <- gets dbBook
713 sect n = do isbook <- gets dbBook