Use table for member information, fix a few design mistakes in period/month display.

This commit is contained in:
Dominik Pantůček 2023-03-22 20:38:06 +01:00
parent eb80b4e709
commit e440d1df56
5 changed files with 84 additions and 33 deletions

View file

@ -31,10 +31,6 @@
*table-border-style*
table->string
table-tests!
;;---
table-row-delimiter
table-row-delimiter/styled
table-borders-lookup
)
(import scheme
@ -48,7 +44,20 @@
utils)
;; Default table border style to use if not explicitly specified.
(define *table-border-style* (make-parameter 'ascii))
(define *table-border-style* (make-parameter 'unicode))
;; Table border styles in visual form
(define table-borders-lookup-source
'((ascii
"/=,\\"
"] |["
">-+<"
"'~^`")
(unicode
"┌─┬┐"
"│ ││"
"├─┼┤"
"└─┴┘")))
;; Returns a list of strings representing the rows in the original
;; string.
@ -130,9 +139,9 @@
(reverse r)
(loop (cdr c)
(cons (let* ((cs (car c))
(csl (string-length cs)))
(csl (ansi-string-length cs)))
(if (< csl w)
(string-append cs (make-string (- w csl) #\space))
(string-append cs (string-repeat " " (- w csl)))
cs))
r)))))
@ -165,19 +174,6 @@
(table-stringify
(table-rectangularize tbl))))))
;; Table border styles in visual form
(define table-borders-lookup-source
'((ascii
"/=,\\"
"] |["
">-+<"
"'~^`")
(unicode
"┌─┬┐"
"│ ││"
"├─┼┤"
"└─┴┘")))
;; Compiled table borders for rendering
(define table-borders-lookup
(map (lambda (src)
@ -237,7 +233,7 @@
(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)))
(border-style (get-keyword #:border-style args (lambda () 'ascii)))
(border-style (get-keyword #:border-style args (lambda () (*table-border-style*))))
(stylepair (assq border-style table-borders-lookup))
(stylevec
(if stylepair