standardize on storing urls as url structs internally instead of as strings

This commit is contained in:
2025-09-05 18:18:14 -07:00
parent bd3f048595
commit 522d253c2a
2 changed files with 8 additions and 10 deletions

View File

@@ -3,9 +3,11 @@
(provide (contract-out
[render (-> document? void?)]
[parse (-> (listof string?) document?)]
[match-link (-> document? integer? (or/c string? #f))]
[match-link (-> document? integer? (or/c url? #f))]
[struct document ((items (listof (or/c text? link? pre?))))]))
(require net/url-string)
;; a gemtext document is represented as a list of structs, a struct
;; for each type of item in a document.
(struct document (items))
@@ -22,7 +24,7 @@
(let ([split (string-split (substring line 2))])
(if (empty? split)
(text line)
(link (car split)
(link (string->url (car split))
(if (>= (length split) 2)
(string-join (cdr split))
(car split))