summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-05-13 17:32:40 -0700
committerBen Sima <ben@bsima.me>2020-05-13 17:32:40 -0700
commit9227a3cdda6767fc4b4275d15a81d8456aacb430 (patch)
tree64fff55e25cf5a044926b24ccd8ff863ef3be34f
parente6ad8129cc854dac38940acb24e3a07cd0cd7b56 (diff)
Convert my org files to md and render
Still some bugs, but I will get to them soon.
-rw-r--r--bs/string.scm1
-rw-r--r--z.scm43
2 files changed, 22 insertions, 22 deletions
diff --git a/bs/string.scm b/bs/string.scm
index b12bf00..789d19b 100644
--- a/bs/string.scm
+++ b/bs/string.scm
@@ -2,6 +2,7 @@
#:export (replace replace-char to-string str capitalize split
strip lstrip rstrip))
+;; this should take a string instead of a char
(define (split s c)
(if s
(string-split s c)
diff --git a/z.scm b/z.scm
index dd091c6..8d86472 100644
--- a/z.scm
+++ b/z.scm
@@ -98,7 +98,7 @@
(created #:getter created
#:init-form (date->string (current-date) "~Y.~m.~d..~H.~M"))
(tags #:accessor tags #:init-keyword #:tags)
- (content #:accessor content #:init-keyword #:content)
+ (content #:accessor get-content #:init-keyword #:content)
(path #:getter path
#:allocation #:virtual
#:slot-set! (lambda (_) #f)
@@ -114,7 +114,7 @@
(format file "created: ~a\n" (created node))
(format file "tags: ~{~a ~}" (tags node))
(display "---\n" file)
- (format file "~a" (content node)))))
+ (format file "~a" (get-content node)))))
(define-generic render-li)
(define-generic render-full)
@@ -243,39 +243,38 @@ NL < '\n'
(respond
`((ul
,@(turn (list-nodes)
- (lambda (id)
- `(li (a (@ (href ,(fmt "/node/~a" id)))
- ,(fmt "~a: ~a"
- (id->string id)
- (title (load-node id))))))))))]
+ (lambda (id)
+ `(li (a (@ (href ,(fmt "/node/~a" (id->string id))))
+ ,(fmt "~a: ~a"
+ (id->string id)
+ (title (load-node id))))))))))]
[("node" id)
(let* ([node (load-node (string->id id))]
- [txt (or (content node) "")])
+ [txt (or (get-content node) "")])
(respond `((pre ,txt))
#:title (fmt "z - ~a" (title node))))]
[("tag")
- (let ((tags (dict.keys *tags*)))
+ (begin
(reindex)
(respond
- `((ul ,@(turn tags
- (lambda [tag]
- `(li (a (@ (href ,(fmt "/tag/~a" tag)))
- ,(fmt "~a" tag)))))))))]
+ `((ul ,@(turn (dict.keys *tags*)
+ (lambda [tag]
+ `(li (a (@ (href ,(fmt "/tag/~a" tag)))
+ ,(fmt "~a" tag)))))))))]
[("tag" tag)
- (let ([ids (tagged tag)])
- (respond
- `((ul ,@(turn ids
- (lambda [id]
- `(li (a (@ (href ,(fmt "/node/~a" id)))
- ,(fmt "~a: ~a"
- (id->string id)
- (title (load-node id)))))))))))]
+ (respond
+ `((ul ,@(turn (tagged tag)
+ (lambda [id]
+ `(li (a (@ (href ,(fmt "/node/~a" id)))
+ ,(fmt "~a: ~a"
+ (id->string id)
+ (title (load-node id))))))))))]
[_ (respond "not found")]))
(define* (serve #:key (port 8080))
(prn "z")
(prn (fmt "port ~a" port))
- (http.run-server routes 'http `(#:port ,port)))
+ (http.run-server routes 'http `(#:port ,port #:host "0.0.0.0")))
;; CLI