blob: 9b20bcf12c598ed3162e7746c04b51ac15e468e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
(define-module (config)
:export (feeds))
(use-modules
(sxml xpath)
(ice-9 regex)
(rss-filter feed-handler)
((ice-9 i18n) :select (make-locale))
((texinfo string-utils) :select (escape-special-chars))
((calp util) :select (->))
((datetime) :select (datetime datetime->string
string->datetime)))
(define feeds
(list
(make-feed
"https://lwn.net/headlines/Features"
`((rss:item
. ,(lambda (key . children)
(define tag (cons key children))
(call-with-values (lambda () (apply values ((sxpath '(rss:title *text*)) tag)))
(case-lambda (() tag)
((title . _)
(if (string-match (escape-special-chars "^[$]" "[]$" #\\)
title)
'() tag))))))))
(make-feed
"https://swordscomic.com/comic/feed/"
`((rss:pubDate
. ,(lambda (key . children)
(list key
(-> (car children)
(string->datetime "~b. ~d, ~Y, ~H:~M ~p" (make-locale LC_TIME "en_US.UTF-8"))
(datetime->string "~Y-~m-~dT~H:~M:~S")))))
(rss:description
. ,(lambda (key . children)
(cons key
;; Each entry has a <style/> tag at the
;; beggining, which brakes the short preview on
;; NetNewsWire. This removes it
(cond ((string-match "</style>" (car children))
=> (lambda (m)
(list (string-drop (car children) (match:end m)))))
(else children)))))
))
))
|