From b2bb8acedce825cef843390077f8a64cab885a0b Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 28 Jun 2024 12:48:44 -0400 Subject: theme: Improve implementation of first-paragraph. Wrote this a long time ago. Not sure why it was so silly. Thanks to elb on IRC for pointing out that the code was trash lol. --- theme.scm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/theme.scm b/theme.scm index 05eec3f..ceafd01 100644 --- a/theme.scm +++ b/theme.scm @@ -38,14 +38,13 @@ (img (@ (src "https://licensebuttons.net/l/by-sa/4.0/80x15.png"))))) (define (first-paragraph post) - (let loop ((sxml (post-sxml post)) - (result '())) + (let loop ((sxml (post-sxml post))) (match sxml - (() (reverse result)) - ((or (('p ...) _ ...) (paragraph _ ...)) - (reverse (cons paragraph result))) + (() '()) + (((and paragraph ('p . _)) . _) + (list paragraph)) ((head . tail) - (loop tail (cons head result)))))) + (cons head (loop tail)))))) (define dthompson-theme (theme #:name "dthompson" -- cgit v1.2.3