diff --git a/gem300.rkt b/gem300.rkt index 99d6363..3989a2a 100644 --- a/gem300.rkt +++ b/gem300.rkt @@ -149,10 +149,14 @@ (inner-iter (list) rst)]) (outer-iter (append acc (list inner-acc)) inner-rst)))) - ;; join each sublist into one string, and display one string per - ;; line - (for-each displayln - (map string-join (outer-iter (list) (string-split paragraph))))) + ;; the algorithm implemented here does not work for empty + ;; paragraphs. thus, they are handled as a special case here. + (if (non-empty-string? paragraph) + ;; join each sublist into one string, and display one string per + ;; line + (for-each displayln + (map string-join (outer-iter (list) (string-split paragraph)))) + (newline))) (define (render-gemtext document) (for-each (λ (line)