Switch table to kwargs proc define, add more day/month support procedures.

This commit is contained in:
Dominik Pantůček 2023-05-19 21:58:14 +02:00
parent c9ba551132
commit fac674f886
4 changed files with 25 additions and 13 deletions

View file

@ -43,7 +43,8 @@
ansi
testing
util-list
util-string)
util-string
util-kwargs)
;; Default table border style to use if not explicitly specified.
(define *table-border-style* (make-parameter 'unicode))
@ -272,19 +273,19 @@
(if tb (sref 3) "")))
;; Converts given table to a list of strings suitable for printing.
(define (table->list tbl . args)
(define-kwproc (table->list tbl
(#:table-border table-border)
(#:row-border row-border)
(#:col-border column-border)
(#:row0-border row0-border)
(#:col0-border col0-border)
(#:border-style border-style (*table-border-style*))
(#:ansi ansi?))
(let ((table (table-prepare tbl)))
(if (or (null? tbl)
(null? (car tbl)))
""
(let* ((table-border (get-keyword #:table-border args (lambda () #f)))
(row-border (get-keyword #:row-border args (lambda () #f)))
(column-border (get-keyword #:col-border args (lambda () #f)))
(row0-border (get-keyword #:row0-border args (lambda () #f)))
(col0-border (get-keyword #:col0-border args (lambda () #f)))
(border-style (get-keyword #:border-style args (lambda () (*table-border-style*))))
(ansi? (get-keyword #:ansi args (lambda () #f)))
(stylepair (assq border-style table-borders-lookup))
(let* ((stylepair (assq border-style table-borders-lookup))
(stylevec
(if stylepair
(cdr stylepair)