diff --git a/src/Makefile b/src/Makefile index 65280dc..c38fd5a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -410,7 +410,8 @@ sgr-list.o: sgr-list.import.scm sgr-list.import.scm: $(SGR-LIST-SOURCES) SGR-BLOCK-SOURCES=sgr-block.scm racket-kwargs.import.scm \ - sgr-state.import.scm sgr-list.import.scm testing.import.scm + sgr-state.import.scm sgr-list.import.scm testing.import.scm \ + util-utf8.import.scm sgr-block.o: sgr-block.import.scm sgr-block.import.scm: $(SGR-BLOCK-SOURCES) diff --git a/src/members-print.scm b/src/members-print.scm index 671a688..7503a46 100644 --- a/src/members-print.scm +++ b/src/members-print.scm @@ -109,20 +109,23 @@ (brmember-credit mr)) #:border '(((#:right light) ... none) ...)))) ((suspend student member council chair revision grant) - (list k - (table->string - (cons (list "Since" "Until") - (map - (lambda (p) - (list - (string-append (cal-day/month->string - (cal-period-since p)) " " - (or (cal-period-scomment p) "")) - (string-append (cal-day/month->string - (cal-period-before p)) " " - (or (cal-period-bcomment p) "")))) - v)) - #:border '(((#:right light) ... none) ...)))) + (let* ((pdata (cons (list "Since" "Until") + (map + (lambda (p) + (list + (string-append (cal-day/month->string + (cal-period-since p)) " " + (or (cal-period-scomment p) "")) + (string-append (cal-day/month->string + (cal-period-before p)) " " + (or (cal-period-bcomment p) "")))) + v))) + (ptbl (table->string + pdata + #:border '(((#:right light) ... none) ...)))) + ;;(print pdata) + ;;(write ptbl)(newline) + (list k ptbl))) (else (if v (list k v) @@ -132,10 +135,11 @@ (mailman (list (list "Mailing Lists" (string-intersperse (brmember-mailman mr) "\n")))) (result (filter identity (append head body mailman)))) + ;;(write result)(newline) (table->string result #:border '(((#:bottom #:right light) ... (#:bottom light)) - ((#:right light) ... none) - ...) + ... + ((#:right light) ... none)) #:ansi-reset? #t))) ;; Prints nicely formatted table diff --git a/src/sgr-block.scm b/src/sgr-block.scm index a143ac2..74eaf19 100644 --- a/src/sgr-block.scm +++ b/src/sgr-block.scm @@ -49,7 +49,8 @@ racket-kwargs sgr-state sgr-list - testing) + testing + util-utf8) ;; Converts sgr-list (possibly containing multiple lines) into a ;; sgr-block @@ -101,7 +102,7 @@ ;; Creates filler for justification of SGR lines (define (make-sgr-list-filler n) - (cons (make-string n #\space) n)) + (cons (make-utf8-string n #\xA0) n)) ;; If first or last non-sgr-state token is space, removes it, ;; converts all spaces to glues. Removes unglue. @@ -172,14 +173,14 @@ (if (sgr-token-glue? tk) (loop (cdr gluelens) (cdr sl) - (cons (cons (make-string (car gluelens)) + (cons (cons (make-utf8-string (car gluelens) #\xA0) (car gluelens)) res)) (loop gluelens (cdr sl) (cons (car sl) res)))))) ;; Nothing to expand, fill-in remainder with spaces - (reverse (cons (cons (make-string rem0) rem0) + (reverse (cons (cons (make-utf8-string rem0 #\xA0) rem0) (reverse sl))))) ;; Nowhere to expand sl))) @@ -361,8 +362,9 @@ (list '()) slw)) state))) - (let-values (((sln) (sgr-list-neutralize sl))) - (values sln initial-state)))) + (let ((sln (sgr-list-neutralize sl))) + ;;(write sln)(newline) + (values (list sln) initial-state)))) ;; Renders all the lines and appends the resulting blocks (define* (sgr-block-render sb @@ -419,7 +421,7 @@ 0 (sgr-list-last-state (car rsb)))) (filler (list state - (cons (make-string sbw) + (cons (make-utf8-string sbw #\xA0) sbw)))) (let loop ((rsb rsb) (rh (- h sbh))) diff --git a/src/sgr-list.scm b/src/sgr-list.scm index 474973b..ca653ed 100644 --- a/src/sgr-list.scm +++ b/src/sgr-list.scm @@ -345,7 +345,8 @@ (when (eq? ch #\tab) (string-set! str idx #\space)) (loop (add1 idx))))) - t)))) + t)) + t)) ;; Neutralizes whole SGR list (define (sgr-list-neutralize sl) diff --git a/src/table-processor.scm b/src/table-processor.scm index ff79d9f..956d9fd 100644 --- a/src/table-processor.scm +++ b/src/table-processor.scm @@ -204,6 +204,8 @@ (tbl1 (render-cells-widths ptbl col-widths)) ;;(_ (print tbl1)) (tbl2 (map expand-row-height tbl1))) + ;;(write tbl1)(newline) + ;;(write tbl2)(newline) ;; Just return the result - both the table and cached column widths (values tbl2 col-widths)))) diff --git a/src/table.scm b/src/table.scm index 719fb1a..43041ff 100644 --- a/src/table.scm +++ b/src/table.scm @@ -88,6 +88,7 @@ (borders (expand-table-style border-spec num-columns num-rows)) (col-separators (table-col-separators? borders)) (rows (merge-rows ptbl borders col-separators unicode?))) + ;;(write rows)(newline) (let loop ((rows rows) (borders borders) (res '())