1 ;; This is a gui tool for editing the Hourglass site configuration
5 (define (pad TXT (N 0))
6 (string TXT (dup " " (max (- N (length TXT)) 0))))
8 (define (wrap TXT (WIDTH 60))
9 (let ((OUT '()) (LN "") (FST 0))
10 (dolist (W (parse (replace "\n" TXT " ") " "))
11 (when (> (+ (length LN) (length W) FST) WIDTH)
12 (push (pad LN) OUT -1)
15 (extend LN (if (= FST) "" " ") W)
17 (unless (empty? LN) (push (pad LN) OUT -1))
20 ; Register all tooltips
21 (dolist (SETTING (parse (read-file "tooltips.txt") "---\n"))
22 (let ((TAG (when (regex "(\\S+)" SETTING 0) $1)))
23 (tk (format "set desc(%s) {%s}" TAG (replace "\n" SETTING " ")))))
25 (tk:load-tcl "sitetool.tcl")
30 (println (eval-string (or (read-line) (exit))))