cripslock

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 9ada974c1098f268ac61bebca906bf3770d9d698
parent bbaaaa358e463574942aad2d400ca0238a29cc49
Author: Daniel Barlow <dan@telent.net>
Date:   Tue,  5 Aug 2025 18:04:23 +0100

textile: add parse-string

This makes the tests easier.  We read the whole thing before parsing
anyway, may as well expose that interface

Diffstat:
Mtextile.fnl | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/textile.fnl b/textile.fnl @@ -358,13 +358,16 @@ filesystem. "]) ) -(fn parse-stream [stream] - (icollect [p (read-blocks stream)] +(fn parse-string [str] + (icollect [_ p (ipairs (extract-blocks str))] (let [(tag body) (tag-and-body p)] (if (= tag :pre) [tag body] (prepend tag (extract-lists body)))))) +(fn parse-stream [stream] + (parse-string (stream:read "*a"))) + (define-tests :parse-stream (expect= (parse-string "h1. Hi") [[:h1 "Hi\n"]])