start firmly defining module boundaries for gmi parser

This commit is contained in:
2025-09-04 14:45:55 -07:00
parent c786466d65
commit 724dc95086

11
gmi.rkt
View File

@@ -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)))