adjust gmi parsing to work on a port. it doesn't actually do this internally, yet, but it will soon.

This commit is contained in:
2025-09-06 20:03:46 -07:00
parent b05dc90e70
commit 91c04ac3c6

View File

@@ -2,7 +2,7 @@
(provide (contract-out
[render (-> document? void?)]
[parse (-> (listof string?) document?)]
[parse (-> input-port? document?)]
[match-link (-> document? integer? (or/c url? #f))]
[struct document ((items (listof (or/c text? link? pre?))))]))
@@ -30,7 +30,7 @@
(car split))
link-#))))
(define (parse lines)
(define (parse body-port)
(define (iter document lines state link-id)
;; when there are no more lines, we have finished parsing.
(if (empty? lines)
@@ -95,7 +95,7 @@
'normal
link-id)])))
(document (iter (list) lines 'normal 1)))
(document (iter (list) (port->lines body-port) 'normal 1)))
;;;
;;; RENDERING