From b1cba4ae8e3380e711a850256eb29063c8d91844 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 8 May 2012 21:44:46 -0700 Subject: DocBook reader: Fixed headers for headerless table. --- src/Text/Pandoc/Readers/DocBook.hs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/DocBook.hs b/src/Text/Pandoc/Readers/DocBook.hs index 90d2bde1a..6a2eedfaf 100644 --- a/src/Text/Pandoc/Readers/DocBook.hs +++ b/src/Text/Pandoc/Readers/DocBook.hs @@ -10,7 +10,7 @@ import Data.Monoid import Data.Char (isSpace) import Control.Monad.State import Control.Applicative ((<$>)) -import Data.List (intersperse) +import Data.List (intersperse, transpose) {- @@ -698,14 +698,16 @@ parseBlock (Elem e) = Just "right" -> AlignRight Just "center" -> AlignCenter _ -> AlignDefault + let numrows = maximum $ map length bodyrows let aligns = case colspecs of - [] -> replicate - (maximum $ map length bodyrows) - AlignDefault + [] -> replicate numrows AlignDefault cs -> map toAlignment cs + let headrows' = if null headrows + then replicate numrows mempty + else headrows return $ table caption (zip aligns (repeat 0)) - headrows bodyrows + headrows' bodyrows isEntry x = named "entry" x || named "td" x || named "th" x parseRow = mapM getBlocks . filterChildren isEntry sect n = do isbook <- gets dbBook -- cgit v1.2.3