summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2024-06-28 12:48:44 -0400
committerDavid Thompson <dthompson2@worcester.edu>2024-06-28 12:48:44 -0400
commitb2bb8acedce825cef843390077f8a64cab885a0b (patch)
tree414f01bf8c5503ca48ec1dd331559e6d239baeb3
parent05893ef4de330da0fb5be4c49d4d62cda3244fde (diff)
theme: Improve implementation of first-paragraph.HEADmaster
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.
-rw-r--r--theme.scm11
1 files 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"