diff options
author | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-22 18:33:12 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@hornquist.se> | 2019-04-22 18:33:12 +0200 |
commit | 79f7122a66ea7f02c5d0ba128363f0ea35983ba8 (patch) | |
tree | 20a247315ba6c42fe096c25a85c4fd36d7998caa /module/main.scm | |
parent | Limit HTML output to single week. (diff) | |
download | calp-79f7122a66ea7f02c5d0ba128363f0ea35983ba8.tar.gz calp-79f7122a66ea7f02c5d0ba128363f0ea35983ba8.tar.xz |
General cleanup.
Diffstat (limited to '')
-rwxr-xr-x | module/main.scm | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/module/main.scm b/module/main.scm index a83f651f..1b38e6e2 100755 --- a/module/main.scm +++ b/module/main.scm @@ -51,6 +51,22 @@ (define (displayln a) (display a) (newline)) +(define (display-event-table events) + (for-each + (lambda (ev i) + (format #t "~a │ ~a~a~a~a │ ~a~a~%" + (time->string (attr ev 'DTSTART) "~1 ~3") ; TODO show truncated string + (if (= i cur-event) "\x1b[7m" "") + (color-escape (attr (parent ev) 'COLOR)) + ;; Summary filter is a hook for the user + (trim-to-width (summary-filter ev (attr ev 'SUMMARY)) 30) + STR-RESET + (trim-to-width + (or (attr ev 'LOCATION) "\x1b[1;30mINGEN LOKAL") 20) + STR-RESET)) + events + (iota (length events)))) + (define (summary-filter _ str) str) (define (main-loop event-stream) @@ -65,24 +81,9 @@ (cls) (display-calendar-header! (time-utc->date time)) - ;; (line) - (displayln (box-top #\┬ #\─ 20 32 10)) - - (for-each - (lambda (ev i) - (format #t "~a │ ~a~a~a~a │ ~a~a~%" - (time->string (attr ev 'DTSTART) "~1 ~3") ; TODO show truncated string - (if (= i cur-event) "\x1b[7m" "") - (color-escape (attr (parent ev) 'COLOR)) - ;; Summary filter is a hook for the user - (trim-to-width (summary-filter ev (attr ev 'SUMMARY)) 30) - STR-RESET - (trim-to-width - (or (attr ev 'LOCATION) "\x1b[1;30mINGEN LOKAL") 20) - STR-RESET)) - events - (iota (length events))) + (displayln (box-top #\┬ #\─ 20 32 10)) + (display-event-table events) (displayln (box-top #\┴ #\─ 20 32 10)) (unless (null? events) @@ -160,4 +161,5 @@ ;; (with-vulgar ;; (lambda () (main-loop events))))) ((@ (sxml simple) sxml->xml) (init html-main)) + (newline) ) |