-
Notifications
You must be signed in to change notification settings - Fork 0
/
haunt.scm
314 lines (277 loc) · 11.4 KB
/
haunt.scm
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
;;; activitypub.rocks website
;;; Copyright © 2016 Christopher Lemmer Webber <[email protected]>
;;;
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
(use-modules (haunt asset)
(haunt site)
(haunt page)
(haunt post)
(haunt html)
(haunt utils)
(haunt builder blog)
(haunt builder atom)
(haunt builder assets)
(haunt reader skribe)
(www reports))
(define %current-directory (getcwd))
(define %implementation-report-directory
(string-append %current-directory
"/reports"))
(define* (base-tmpl site body #:key title)
`((doctype "html")
(head
(meta (@ (charset "utf-8")))
(title ,(if title
(string-append title " -- ActivityPub Rocks!")
(site-title site)))
;; css
(link (@ (rel "stylesheet")
(href "static/css/main.css")))
;; atom feed
(link (@ (rel "alternate")
(title "ActivityPub news")
(type "application/atom+xml")
(href "feed.xml"))))
(body
(div (@ (class "main-wrapper"))
(header (@ (id "site-header"))
(a (@ (href "")
;; (style "margin-left: -25px;")
)
(img (@ (src "static/images/ActivityPub-logo.svg"))))
;; ;; Header menu
;; (div (@ ,(if big-logo
;; '(class "navbar-menu big-navbar")
;; '(class "navbar-menu small-navbar")))
;; ,@(map
;; (lambda (item)
;; (match item
;; ((name url)
;; `(div
;; (a (@ (href url))
;; ,name)))))
;; header-menu))
)
(div (@ (class "site-main-content"))
,body))
(div (@ (class "footer"))
(a (@ (href "https://gitlab.com/dustyweb/activitypub.rocks"))
"Site contents")
" dual licensed under "
(a (@ (href "https://creativecommons.org/licenses/by-sa/4.0/"))
"Creative Commons Attribution-Sharealike 4.0 International")
" and "
(a (@ (href "http://www.gnu.org/licenses/gpl-3.0.en.html"))
"the GNU GPL, version 3 or any later version")
". ActivityPub logo by mray, released into public domain under "
(a (@ (href "https://creativecommons.org/publicdomain/zero/1.0/"))
"CC0 1.0")
". Powered by "
(a (@ (href "http://haunt.dthompson.us/"))
"Haunt")
"."))))
;;; Blog
(define (post-uri site post)
(string-append "/news/" (site-post-slug site post) ".html"))
(define* (post-template post #:key post-link)
`(div (@ (class "content-box blogpost"))
(header (@ (class "post-title"))
,(if post-link
`(a (@ (href ,post-link))
,(post-ref post 'title))
(post-ref post 'title)))
(div (@ (class "post-about"))
(span (@ (class "by-line"))
,(post-ref post 'author))
" -- " ,(date->string* (post-date post)))
(div (@ (class "post-body"))
,(post-sxml post))))
(define (collection-template site title posts prefix)
;; In our case, we ignore the prefix argument because
;; the filename generated and the pathname might not be the same.
;; So we use (prefix-url) instead.
(define (post-uri post)
(string-append "/news/" (site-post-slug site post) ".html"))
`((div (@ (class "news-header"))
(h3 "recent news"))
(div (@ (class "post-list"))
,@(map
(lambda (post)
(post-template post
#:post-link (post-uri post)))
posts))))
(define aprocks-haunt-theme
(theme #:name "ActivityPub Rocks"
#:layout
(lambda (site title body)
(base-tmpl
site body
#:title title))
#:post-template post-template
#:collection-template collection-template))
;;; Index page
(define tutorial-image
`(div (@ (style "text-align: center"))
(a (@ (href "https://www.w3.org/TR/activitypub/#Overview"))
(img (@ (src "static/images/ActivityPub-tutorial-image.png")
(alt "ActivityPub tutorial image"))))))
(define read-it
(let ((wrap-it
(lambda (link name)
`(p "==> "
(a (@ (href ,link))
,name)
" <=="))))
`(div (@ (class "read-it"))
,(wrap-it "https://www.w3.org/TR/activitypub/"
"Latest published version")
,(wrap-it "https://w3c.github.io/activitypub/"
"Latest editor's draft"))))
(define pitch
`(div
(@ (class "pitch")
(style "text-align: justify;"))
(p "Don't you miss the days when the web really was the world's greatest "
"decentralized network? Before everything got locked down into a handful "
"of walled gardens? So do we.")
,tutorial-image
;; Main intro
(p "Enter "
(a (@ (href "https://www.w3.org/TR/activitypub/"))
"ActivityPub")
"! ActivityPub is a decentralized social networking protocol "
"based on the "
(a (@ (href "https://www.w3.org/TR/activitystreams-core/"))
"ActivityStreams 2.0")
" data format. "
"ActivityPub is an official W3C recommended standard published by the "
(a (@ (href "https://www.w3.org/wiki/Socialwg"))
"W3C Social Web Working Group")
". "
"It provides a client to server API for creating, updating and deleting "
"content, as well as a federated server to server API for delivering "
"notifications and subscribing to content.")
;; (p "Applications already having adopted or adopting ActivityPub include: "
;; )
;; TODO: Mention existing applications adopting ActivityPub
(p "Sounds exciting? Dive in!")
,read-it
(p "Or, are you a user looking for ActivityPub software to use? "
"Check out this "
(a (@ (href "https://socialhub.activitypub.rocks/pub/guide-for-activitypub-users"))
"guide for ActivityPub users")
" (community edited)!")
))
(define for-implementers
`(div (@ (class "for-implementers-box"))
(header "~= Hey, Implementers! =~")
(p "We're so stoked to have you implementing ActivityPub! "
"To make sure ActivityPub implementations work together, we have:")
(ul (li (strong (a (@ (href "https://socialhub.activitypub.rocks/pub/guide-for-new-activitypub-implementers"))
"Guide for new ActivityPub implementers"))
" -- " ; space between link and item
" Community edited and unofficial, but useful!")
(li (strong (a (@ (href "https://test.activitypub.dev/"))
"A test suite:"))
" -- " ; space between link and item
"Make sure your application works right according to the "
(a (@ (href "https://www.w3.org/TR/activitypub/"))
"ActivityPub standard") ".")
(li (strong (a (@ (href "implementation-report/"))
"Implementation reports:"))
" -- " ; space between link and item
"See the implementation coverage of applications which implemented "
"ActivityPub during the standardization process."))
(p "Looking to discuss implementing ActivityPub? You can join the "
(code "#social") " IRC channel on " (code "irc.w3.org") "! "
"See also "
(a (@ (href "https://socialhub.activitypub.rocks/"))
"SocialHub")
", a community-run forum to discuss ActivityPub developments and ideas, "
"and the "
(a (@ (href "https://www.w3.org/wiki/SocialCG"))
"Social CG")
", a W3C Community Group to continue the work of advancing the "
"federated social web... including ActivityPub!")))
(define (news-feed site posts)
`(div (@ (class "news-feed"))
(header "-=* ActivityPub News *=-")
(ul
,(map (lambda (post)
`(li (a (@ (href ,(post-uri site post)))
,(post-ref post 'title))
(div (@ (class "news-feed-item-date"))
,(date->string* (post-date post)))))
(take-up-to 10 (posts/reverse-chronological posts))))))
(define (index-content site posts)
`(div ,pitch
,for-implementers ,(news-feed site posts)))
(define (index-page site posts)
(make-page
"index.html"
(base-tmpl site
(index-content site posts))
sxml->html))
;;; Test and implementations report stub pages
(define (test-page-tmpl site)
(define tmpl
'(div
(p "The test suite is at: "
(a (@ (href "https://test.activitypub.rocks/"))
"https://test.activitypub.rocks/"))))
(base-tmpl site tmpl))
(define (test-page site posts)
(make-page
"test/index.html"
(test-page-tmpl site)
sxml->html))
(define (impl-report-page-tmpl site)
(define reports
(load-all-implementation-reports
%implementation-report-directory))
(define tmpl
`(div
(p (i "To submit an implementation report, use the "
(a (@ (href "https://test.activitypub.rocks/"))
"ActivityPub test suite")
" to generate an implementation report and then submit "
"that report to the "
(a (@ (href "https://github.com/w3c/activitypub/issues"))
"ActivityPub issue tracker") ". "
"(Or, file a PR directly to "
(a (@ (href "https://gitlab.com/dustyweb/activitypub.rocks/tree/master/reports"))
"this site's repository") ".)"))
(h3 "Implementation reports")
,(render-implementation-reports reports)
,@(additional-report-notes reports)))
(base-tmpl site tmpl))
(define (impl-report-page site posts)
(make-page
"implementation-report/index.html"
(impl-report-page-tmpl site)
sxml->html))
;;; Site
(site #:title "ActivityPub Rocks!"
#:domain "activitypub.rocks"
#:default-metadata
'((author . "Christopher Lemmer Webber"))
#:readers (list skribe-reader)
#:builders (list (blog #:prefix "/news"
#:theme aprocks-haunt-theme)
index-page
test-page
impl-report-page
(atom-feed #:blog-prefix "/news")
(static-directory "static" "static")
(atom-feeds-by-tag)))