summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/DocBook.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-05-08 21:44:46 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-05-08 21:44:46 -0700
commitb1cba4ae8e3380e711a850256eb29063c8d91844 (patch)
treeadf4e38382014c2b8d33e888515e37c51fd86674 /src/Text/Pandoc/Readers/DocBook.hs
parentf1869a05fde9a8487b2cae353bd36c8308d602af (diff)
DocBook reader: Fixed headers for headerless table.
Diffstat (limited to 'src/Text/Pandoc/Readers/DocBook.hs')
-rw-r--r--src/Text/Pandoc/Readers/DocBook.hs12
1 files changed, 7 insertions, 5 deletions
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