Prepare column normalization.
This commit is contained in:
parent
fb7701869d
commit
b919898057
1 changed files with 23 additions and 3 deletions
26
table.scm
26
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)
|
||||
"")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue