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:
6
gmi.rkt
6
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
|
||||
|
Reference in New Issue
Block a user