@@ 230,8 230,8 @@ finalizeTable root parent val opts childs = LayoutGrid val grid cells' childs'
decorateCol (StyleTree self@CSSBox { display = TableColumn } _:rest) h col =
buildDecor self col 1 0 h:decorateCol rest h (succ col)
decorateCol (StyleTree self@CSSBox { display = TableColumnGroup } childs:rest)
- h col = buildDecor self col (countCols childs) 0 h:
- decorateCol (childs ++ rest) h (col + countCols childs)
+ h col = buildDecor self col (countCols' childs self) 0 h:
+ decorateCol (childs ++ rest) h (col + countCols' childs self)
decorateCol (_:rest) h col = decorateCol rest h col
decorateCol [] _ _ = []
@@ 243,8 243,16 @@ finalizeTable root parent val opts childs = LayoutGrid val grid cells' childs'
| d `elem` [TableCaption, TableColumn, TableColumnGroup] = countRows rest
| otherwise = succ $ countRows $ dropWhile (not . isRowGroup) rest
countRows [] = 0
- countCols (StyleTree CSSBox { display = TableColumn } _:rest) =
- succ $ countCols rest
+ countCols' cols@(_:_) _ = countCols cols
+ countCols' _ CSSBox { tableOptions = TableOptions { colspan = x } } = x
+ countCols (StyleTree CSSBox {
+ display = TableColumn,
+ tableOptions = TableOptions { colspan = x }
+ } _:rest) = x + countCols rest
+ countCols (StyleTree CSSBox {
+ display = TableColumnGroup,
+ tableOptions = TableOptions { colspan = x }
+ } []:rest) = x + countCols rest
countCols (StyleTree CSSBox { display = TableColumnGroup } childs:rest) =
countCols childs + countCols rest
countCols (_:rest) = countCols rest