aboutsummaryrefslogtreecommitdiff
path: root/haunt/outbox.scm
blob: 04ea7756e571281f5c41eedfca10ff2adc7cf560 (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
53
54
55
56
57
;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>
;;;
;;; 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 (srfi srfi-19))

(define %comments
  `(("https://aaronparecki.com/2018/06/30/11/your-first-webmention"
     "@aaronpk"
     "<2019-05-11 Sat 17:07>"
     (p (@ (class "e-content"))
        "Hoo, this comments section is a bit of a mess. "
        "Anyway, I'm just testing out Webmentions like everyone else. "
        "Don't mind me..."))
    ("http://jakob.space/transition-to-haunt.html"
     "@jakob"
     "<2019-05-12 Sun 12:07>"
     (p (@ (class "e-content"))
        "Just testing out my Webmention inbox widget."))))

(define (h-card)
  `(div (@ (class "u-author h-card"))
        (img (@ (src "/images/favicon.png")
                (class "u-photo")))
        (a (@ (href "http://jakob.space")
              (class "u-url p-name"))
           (p "Jakob L. Kreuze"))))

(define (comment target-uri target-handle date sxml)
  (let ((date (string->date date "<~Y-~m-~d ~a ~H:~M>")))
    `(li (@ (class "h-entry"))
         ,(h-card)
         (p "in reply to: " (a (@ (class "u-in-reply-to")
                                  (href ,target-uri))
                               ,target-handle))
         ,sxml
         (a (@ (href "http://jakob.space/outbox.html")
               (class "u-url"))
            (time (@ (class "dt-published")
                     (datetime ,(date->string date "~Y-~m-~dT~H:~M:~S~z")))
                  ,(date->string date "~c"))))))

`((h2 "Webmention Outbox")
  (ul (@ (id "webmention-container"))
      ,@(map (lambda (args) (apply comment args)) %comments)))

© 2015 - 2026 Jakob L. Kreuze