@@ -185,24 +185,24 @@ blockToDocbook _ (RawBlock "html" str) = text str -- raw XML block
185185blockToDocbook _ (RawBlock _ _) = empty
186186blockToDocbook _ HorizontalRule = empty -- not semantic
187187blockToDocbook opts (Table caption aligns widths headers rows) =
188− let alignStrings = map alignmentToString aligns
189− captionDoc = if null caption
188+ let captionDoc = if null caption
190189 then empty
191− else inTagsIndented "caption"
190+ else inTagsIndented "title"
192191 (inlinesToDocbook opts caption)
193192 tableType = if isEmpty captionDoc then "informaltable" else "table"
194− percent w = show (truncate (100*w) :: Integer) ++ "%"
195− coltags = if all (== 0.0) widths
196− then empty
197− else vcat $ map (\w ->
198− selfClosingTag "col" [("width", percent w)]) widths
193+ percent w = show (truncate (100*w) :: Integer) ++ "*"
194+ coltags = vcat $ zipWith (\w al -> selfClosingTag "colspec"
195+ ([("colwidth", percent w) | w > 0] ++
196+ [("align", alignmentToString al)])) widths aligns
199197 head' = if all null headers
200198 then empty
201199 else inTagsIndented "thead" $
202− tableRowToDocbook opts alignStrings "th" headers
200+ tableRowToDocbook opts headers
203201 body' = inTagsIndented "tbody" $
204− vcat $ map (tableRowToDocbook opts alignStrings "td") rows
205− in inTagsIndented tableType $ captionDoc $$ coltags $$ head' $$ body'
202+ vcat $ map (tableRowToDocbook opts) rows
203+ in inTagsIndented tableType $ captionDoc $$
204+ (inTags True "tgroup" [("cols", show (length headers))] $
205+ coltags $$ head' $$ body')
206206
207207alignmentToString :: Alignment -> [Char]
208208alignmentToString alignment = case alignment of
@@ -212,22 +212,16 @@ alignmentToString alignment = case alignment of
212212 AlignDefault -> "left"
213213
214214tableRowToDocbook :: WriterOptions
215− -> [String]
216− -> String
217215 -> [[Block]]
218216 -> Doc
219−tableRowToDocbook opts aligns celltype cols =
220− inTagsIndented "tr" $ vcat $
221− zipWith (tableItemToDocbook opts celltype) aligns cols
217+tableRowToDocbook opts cols =
218+ inTagsIndented "row" $ vcat $ map (tableItemToDocbook opts) cols
222219
223220tableItemToDocbook :: WriterOptions
224− -> [Char]
225− -> [Char]
226221 -> [Block]
227222 -> Doc
228−tableItemToDocbook opts tag align item =
229− let attrib = [("align", align)]
230− in inTags True tag attrib $ vcat $ map (blockToDocbook opts) item
223+tableItemToDocbook opts item =
224+ inTags True "entry" [] $ vcat $ map (blockToDocbook opts) item
231225
232226-- | Convert a list of inline elements to Docbook.
233227inlinesToDocbook :: WriterOptions -> [Inline] -> Doc