diff options
Diffstat (limited to 'z.scm')
-rw-r--r-- | z.scm | 24 |
1 files changed, 10 insertions, 14 deletions
@@ -155,7 +155,7 @@ (define (index-node id) (let ([node (load-node id)]) (dict.set *titles* (title node) id) - (for (tags node) + (turn (tags node) (/. tag (if tag (dict.update @@ -177,14 +177,6 @@ (define (get-by-title title) (dict.get *titles* title)) - ;; Printing - -(define (print-titles) - (for (list-nodes) - (lambda (id) - (pr id) (pr ": ") - (prn (title (load-node id)))))) - ;; webserver (define *css* "body{max-width:650px;margin:40px auto;padding:0 10px;font:18px/1.5 -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\";color:#444}h1,h2,h3{line-height:1.2}@media (prefers-color-scheme: dark){body{color:white;background:#444}a:link{color:#5bf}a:visited{color:#ccf}}") @@ -240,7 +232,7 @@ ['() (respond `((ul - ,@(for (list-nodes) + ,@(turn (list-nodes) (lambda (id) `(li (a (@ (href ,(fmt "/node/~a" id))) ,(fmt "~a: ~a" @@ -254,14 +246,14 @@ (let ((tags (dict.keys *tags*))) (reindex) (respond - `((ul ,@(for tags + `((ul ,@(turn tags (lambda [tag] `(li (a (@ (href ,(fmt "/tag/~a" tag))) ,(fmt "~a" tag)))))))))] [("tag" tag) (let ([ids (tagged tag)]) (respond - `((ul ,@(for ids + `((ul ,@(turn ids (lambda [id] `(li (a (@ (href ,(fmt "/node/~a" id))) ,(fmt "~a: ~a" @@ -292,11 +284,15 @@ where 'command' is: [editor (os.getenv "EDITOR")]) (subprocess.call (list editor (path node))) (exit EXIT_SUCCESS))] - [("ls") (print-titles)] + [("ls") + (turn (list-nodes) + (lambda (id) + (pr id) (pr ": ") + (prn (title (load-node id)))))] [("tagged" tag) (begin (reindex) - (for (tagged tag) + (turn (tagged tag) (lambda (id) (pr id) (pr ": ") |