This repository was archived by the owner on Apr 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtemplate.xml.p
More file actions
71 lines (70 loc) · 1.96 KB
/
template.xml.p
File metadata and controls
71 lines (70 loc) · 1.96 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
◊(define (skip-feed post)
(select-from-metas 'skip-feed post))
◊(define (title post)
(select-from-metas 'title post))
◊(define (subtitle post)
(select-from-metas 'subtitle post))
◊(define (uuid post)
(string-append
"urn:uuid:"
(select-from-metas 'uuid post)))
◊(define (published post)
(select-from-metas 'published post))
◊(define (updated post)
(select-from-metas 'updated post))
◊(define (validate post)
(check-meta 'title post)
(check-meta 'uuid post)
(check-meta 'published post)
(check-meta 'updated post)
post)
◊(define (check-meta sym post)
(when (not (select-from-metas sym post))
(printf "MISSING REQUIRED META '~a from ~a\n" sym post)))
◊(define posts
(map validate
(filter (λ (post)
(not (skip-feed post)))
(pagetree->list toc-pagetree))))
◊(define (entry post)
(->html
`((entry
,@(entry-content post)
"\n")
"\n")))
◊(define (entry-content post)
(add-between
(filter-entry-content
`((title ,(title post))
(published ,(published post))
(updated ,(updated post))
(id ,(uuid post))
(link ((href ,(abs-url post))))
(content [[type "html"]] ,(feed-content post))))
;(summary [[type "html"]] ,(feed-summary post))))
"\n\t"))
◊(define (filter-entry-content cs)
; We don't require subtitles be in all posts, this is a general implementation.
(filter (λ (x)
(cadr x))
cs))
◊(define latest-update
(foldr (λ (a b)
(if (string>? a b)
a
b))
""
(map updated posts)))
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>◊|main-title|</title>
<link href="◊(abs-url here)" rel="self"/>
<link href="◊|root-url|"/>
<author>
<name>Jonas Hietala</name>
<email>◊|email|</email>
</author>
<id>◊(uuid here)</id>
<updated>◊|latest-update|</updated>
◊(map entry posts)
</feed>