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