diff --git a/table.scm b/table.scm index 8a88112..4e82d8a 100644 --- a/table.scm +++ b/table.scm @@ -86,11 +86,31 @@ (let ((ml (apply max (map length row)))) (map (make-list-extender ml) row))) + ;; Normalizes the number of text lines in each table row. + (define (table-normalize-rows tbl) + (map table-normalize-row tbl)) + + ;; Returns the maximum width of each column of the table. + (define (table-column-widths tbl) + '()) + + (define (table-row-normalize-cells row cwidths) + row) + + ;; Normalizes cells in all rows to match the widths of the wides cell + ;; in each column. + (define (table-normalize-columns tbl) + (let ((cwidths (table-column-widths tbl))) + (map (lambda (row) + (table-row-normalize-cells row cwidths)) + tbl))) + ;; Ensures the table is rectangular and each cell is a list of strings. (define (table-prepare tbl) - (table-prepare-cells - (table-stringify - (table-rectangularize tbl)))) + (table-normalize-rows + (table-prepare-cells + (table-stringify + (table-rectangularize tbl))))) (define (table->string tbl . args) "")