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