start firmly defining module boundaries for gmi parser
This commit is contained in:
11
gmi.rkt
11
gmi.rkt
@@ -1,9 +1,14 @@
|
||||
#lang racket
|
||||
|
||||
(provide parse render)
|
||||
(provide (contract-out
|
||||
[render (-> document? void?)]
|
||||
[parse (-> (listof string?) document?)]
|
||||
[struct document ((structure (listof (or/c text? link? pre?))))]))
|
||||
|
||||
;; a gemtext document is represented as a list of structs, a struct
|
||||
;; for each type of item in a document.
|
||||
(struct document (structure))
|
||||
|
||||
(struct text (str))
|
||||
(struct link (url str ord))
|
||||
(struct pre (str))
|
||||
@@ -87,7 +92,7 @@
|
||||
'normal
|
||||
link-#)])))
|
||||
|
||||
(iter (list) lines 'normal 1))
|
||||
(document (iter (list) lines 'normal 1)))
|
||||
|
||||
;;;
|
||||
;;; RENDERING
|
||||
@@ -141,4 +146,4 @@
|
||||
|
||||
[(link? line)
|
||||
(printf "[~a] ~a\n" (link-ord line) (link-str line))]))
|
||||
document))
|
||||
(document-structure document)))
|
||||
|
Reference in New Issue
Block a user