summaryrefslogtreecommitdiff
path: root/tissue.scm
blob: bdeac24fcfb85e4d04a5d6a454a1599ea178c7b2 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
(import (tissue tissue))

(define %css
  "/style.css")

(define %engine
  (html-engine #:css %css))

(define %github-repo-uri
  "https://github.com/genenetwork/gn-gemtext-threads")

(define %repo-branch
  "main")

(define (genenetwork-gemtext-reader file)
  (lambda (port)
    (match ((gemtext-reader) port)
      ((? eof-object? eof) eof)
      (('document body ...)
       `(document
         (ref #:url ,(string-append %github-repo-uri "/edit/" %repo-branch "/" file)
              #:text "Edit this page")
         " | "
         (ref #:url ,(string-append %github-repo-uri "/blame/" %repo-branch "/" file)
              #:text "Blame")
         ,@body)))))

(tissue-configuration
 #:aliases '(("Alexander Kabui" "Alexander" "alex" "alexk")
             ("Arun Isaac" "arun" "aruni")
             ("BonfaceKilz" "Bonface Kilz" "bonfacem")
             ("Efraim Flashner" "efraimf")
             ("Erik Garrison" "erikg")
             ("Frederick Muriuki Muriithi" "Muriithi Frederick Muriuki" "fredm" "fred")
             ("Pjotr Prins" "pjotrp")
             ("Rob Williams" "robw")
             ("Arthur Centeno" "acenteno")
             ("jgart")
	     ("Solomon Shelby" "soloshelby" "SidiBlak")
	     ("priscilla")
             ("Zachary Sloan" "zach" "zachs" "zsloan"))
 #:indexed-documents (append (map (lambda (filename)
                                    (slot-set (read-gemtext-issue filename)
                                              'web-uri
                                              (string-append "/" (string-remove-suffix ".gmi" filename))))
                                  (gemtext-files-in-directory "issues"))
                             (map (lambda (filename)
                                    (slot-set (read-gemtext-document filename)
                                              'web-uri
                                              (string-append "/" (string-remove-suffix ".gmi" filename))))
                                  (gemtext-files-in-directory "topics")))
 #:web-files (cons* (file "style.css"
                          (copier "style.css"))
                    (filter-map (lambda (filename)
                                  (cond
                                   ((and (string-suffix? ".gmi" filename)
                                         (not (string=? (basename filename)
                                                        "README.gmi")))
                                    (file (replace-extension filename "html")
                                          (gemtext-exporter filename
                                                            #:reader (genenetwork-gemtext-reader filename)
                                                            #:engine %engine)))
                                   ((or (string-suffix? ".jpg" filename)
                                        (string-suffix? ".png" filename)
                                        (string-suffix? ".svg" filename)
                                        (string-suffix? ".scm" filename))
                                    (file filename
                                          (copier filename)))
                                   (else #f)))
                                (git-tracked-files))))