X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=haunt.scm;h=7222df96fafad9c7f2f6d421399e029e5afb897a;hb=01ffe1178b7017dcb2ae11bec265f4316c79383a;hp=0a6fa503e4315f6cb710af4a8fd40259fb065403;hpb=16b2c33322417be6d88ecb431116c8fcdd0677d1;p=blog.git diff --git a/haunt.scm b/haunt.scm index 0a6fa50..7222df9 100644 --- a/haunt.scm +++ b/haunt.scm @@ -90,10 +90,14 @@ (site-post-slug site post) ".html")) (define (get-paragraphs sxml count) - (let ((pars (filter - (lambda (e) (and (pair? e) (eq? (car e) 'p))) - sxml))) - (list-head pars (min count (length pars))))) + (define (getp sxml count res) + (cond ((or (= count 0) (null? sxml)) + res) + ((and (pair? (car sxml)) (eq? (caar sxml) 'p)) + (getp (cdr sxml) (- count 1) (cons (car sxml) res))) + (else + (getp (cdr sxml) count (cons (car sxml) res))))) + (reverse (getp sxml count '()))) (define (post-summary post) (or (post-ref post 'summary)