cripslock

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

commit 740df319cd7a429ba77a766b5870aae7809d2be6
parent d7431e8062abe640f35a336fa41b8a2da965754f
Author: Daniel Barlow <dan@telent.net>
Date:   Mon, 21 Jul 2025 19:46:38 +0100

textile: handle multiple blank lines between paras

Diffstat:
Mtextile.fnl | 15+++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/textile.fnl b/textile.fnl @@ -5,11 +5,12 @@ (fn read-blocks [stream] (fn [] - (let [lines (icollect [l #(stream:read "L") - &until (= l "\n")] - l)] - (if (= (# lines) 0) - nil + (if (not (stream:read 0)) ; eof + nil + (let [lines (icollect [l #(stream:read "L") + &until (or (not l) (= l "\n"))] + (do + l))] (table.concat lines ""))))) (fn cons-tag [tag content] @@ -211,7 +212,7 @@ (or (inline-markup preamble) []) [(cons-tag tag (icollect [_ i (ipairs lists)] (cons-tag :li (extract-lists i))))]) - (inline-markup preamble)))) + (or (inline-markup preamble) [])))) (define-tests :extract-lists @@ -267,6 +268,8 @@ [:li [:em "emph"] " item 2\n"] [:li "item 3\n"]]]) + (expect= (extract-lists "") []) + ) (fn parse-stream [stream]