From 91c04ac3c6f115639e6dda9bb49c7d9a96a5804c Mon Sep 17 00:00:00 2001 From: w6vvn Date: Sat, 6 Sep 2025 20:03:46 -0700 Subject: [PATCH] adjust gmi parsing to work on a port. it doesn't actually do this internally, yet, but it will soon. --- gmi.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gmi.rkt b/gmi.rkt index c9d9b0e..30751ed 100644 --- a/gmi.rkt +++ b/gmi.rkt @@ -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