@@ -185,24 +185,24 @@ blockToDocbook _ (RawBlock "html" str) = text str -- raw XML block
185blockToDocbook _ (RawBlock _ _) = empty
185blockToDocbook _ (RawBlock _ _) = empty
186blockToDocbook _ HorizontalRule = empty -- not semantic
186blockToDocbook _ HorizontalRule = empty -- not semantic
187blockToDocbook opts (Table caption aligns widths headers rows) =
187blockToDocbook opts (Table caption aligns widths headers rows) =
188− let alignStrings = map alignmentToString aligns
189− captionDoc = if null caption
188+ let captionDoc = if null caption
190 then empty
189 then empty
191− else inTagsIndented "caption"
190+ else inTagsIndented "title"
192 (inlinesToDocbook opts caption)
191 (inlinesToDocbook opts caption)
193 tableType = if isEmpty captionDoc then "informaltable" else "table"
192 tableType = if isEmpty captionDoc then "informaltable" else "table"
194− percent w = show (truncate (100*w) :: Integer) ++ "%"
193+ percent w = show (truncate (100*w) :: Integer) ++ "*"
195− coltags = if all (== 0.0) widths
194+ coltags = vcat $ zipWith (\w al -> selfClosingTag "colspec"
196− then empty
195+ ([("colwidth", percent w) | w > 0] ++
197− else vcat $ map (\w ->
196+ [("align", alignmentToString al)])) widths aligns
198− selfClosingTag "col" [("width", percent w)]) widths
199 head' = if all null headers
197 head' = if all null headers
200 then empty
198 then empty
201 else inTagsIndented "thead" $
199 else inTagsIndented "thead" $
202− tableRowToDocbook opts alignStrings "th" headers
200+ tableRowToDocbook opts headers
203 body' = inTagsIndented "tbody" $
201 body' = inTagsIndented "tbody" $
204− vcat $ map (tableRowToDocbook opts alignStrings "td") rows
202+ vcat $ map (tableRowToDocbook opts) rows
205− in inTagsIndented tableType $ captionDoc $$ coltags $$ head' $$ body'
203+ in inTagsIndented tableType $ captionDoc $$
204+ (inTags True "tgroup" [("cols", show (length headers))] $
205+ coltags $$ head' $$ body')
207alignmentToString :: Alignment -> [Char]
207alignmentToString :: Alignment -> [Char]
208alignmentToString alignment = case alignment of
208alignmentToString alignment = case alignment of
@@ -212,22 +212,16 @@ alignmentToString alignment = case alignment of
212 AlignDefault -> "left"
212 AlignDefault -> "left"
214tableRowToDocbook :: WriterOptions
214tableRowToDocbook :: WriterOptions
217 -> [[Block]]
215 -> [[Block]]
219−tableRowToDocbook opts aligns celltype cols =
217+tableRowToDocbook opts cols =
220− inTagsIndented "tr" $ vcat $
221− zipWith (tableItemToDocbook opts celltype) aligns cols
218+ inTagsIndented "row" $ vcat $ map (tableItemToDocbook opts) cols
223tableItemToDocbook :: WriterOptions
220tableItemToDocbook :: WriterOptions
226 -> [Block]
221 -> [Block]
228−tableItemToDocbook opts tag align item =
223+tableItemToDocbook opts item =
229− let attrib = [("align", align)]
230− in inTags True tag attrib $ vcat $ map (blockToDocbook opts) item
224+ inTags True "entry" [] $ vcat $ map (blockToDocbook opts) item
232-- | Convert a list of inline elements to Docbook.
226-- | Convert a list of inline elements to Docbook.
233inlinesToDocbook :: WriterOptions -> [Inline] -> Doc
227inlinesToDocbook :: WriterOptions -> [Inline] -> Doc