Prepare column normalization.

This commit is contained in:
Dominik Pantůček 2023-03-22 10:16:51 +01:00
parent fb7701869d
commit b919898057

View file

@ -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)
"")