From 724dc95086702ac0e54db788b5d2087483f8adcc Mon Sep 17 00:00:00 2001 From: w6vvn Date: Thu, 4 Sep 2025 14:45:55 -0700 Subject: [PATCH] start firmly defining module boundaries for gmi parser --- gmi.rkt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gmi.rkt b/gmi.rkt index c6773ec..919c5f8 100644 --- a/gmi.rkt +++ b/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)))