multiple with query args add tags to the set
* tekuti/page.scm (page-feed-atom): Reimplement more clearly, and give "with" inclusionary meaning.
This commit is contained in:
parent
08e1e58f1f
commit
cee672f117
1 changed files with 23 additions and 15 deletions
|
@ -343,22 +343,30 @@
|
||||||
(tags (assq-ref index 'tags))
|
(tags (assq-ref index 'tags))
|
||||||
(posts (assq-ref index 'posts))
|
(posts (assq-ref index 'posts))
|
||||||
(master (assq-ref index 'master)))
|
(master (assq-ref index 'master)))
|
||||||
(atom-feed-from-posts
|
(define include?
|
||||||
request body index
|
(if (pair? with)
|
||||||
(filter-mapn (fold (lambda (tag cont)
|
|
||||||
(let ((posts (hash-ref tags tag '())))
|
|
||||||
(lambda (post)
|
|
||||||
(and (not (member (post-key post) posts))
|
|
||||||
(cont post)))))
|
|
||||||
(fold (lambda (tag cont)
|
(fold (lambda (tag cont)
|
||||||
(let ((posts (hash-ref tags tag '())))
|
(let ((posts (hash-ref tags tag '())))
|
||||||
(lambda (post)
|
(lambda (post)
|
||||||
(and (member (post-key post) posts)
|
(or (member (post-key post) posts)
|
||||||
(cont post)))))
|
(cont post)))))
|
||||||
(lambda (post)
|
(lambda (post) #f)
|
||||||
(and (post-published? post)
|
|
||||||
post))
|
|
||||||
with)
|
with)
|
||||||
without)
|
(lambda (post) #t)))
|
||||||
|
(define exclude?
|
||||||
|
(fold (lambda (tag cont)
|
||||||
|
(let ((posts (hash-ref tags tag '())))
|
||||||
|
(lambda (post)
|
||||||
|
(or (member (post-key post) posts)
|
||||||
|
(cont post)))))
|
||||||
|
(lambda (post) #f)
|
||||||
|
without))
|
||||||
|
|
||||||
|
(atom-feed-from-posts
|
||||||
|
request body index
|
||||||
|
(filter-mapn (lambda (post)
|
||||||
|
(and (include? post) (not (exclude? post))
|
||||||
|
(post-published? post)
|
||||||
|
post))
|
||||||
posts
|
posts
|
||||||
10))))
|
10))))
|
||||||
|
|
Loading…
Reference in a new issue