summaryrefslogtreecommitdiffstats
path: root/apps/media/builder.scm
blob: a1a74a18fcc2432c61bc93d0db166c1864cb7ffd (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
;;; Harmonic Flow web site

(define-module (apps media builder)
  #:use-module (apps aux system)
  #:use-module (apps base utils)
  #:use-module (apps media data)
  #:use-module (apps media templates screenshot)
  #:use-module (apps media templates screenshots-overview)
  #:use-module (apps media types)
  #:use-module (haunt artifact)
  #:use-module (haunt html)
  #:use-module (haunt utils)
  #:use-module (apps aux web)
  #:use-module (srfi srfi-19)
  #:export (builder))


;;;
;;; Application builder.
;;;

(define (builder site posts)
  "Return the list of web resources that compose the app.

   This procedure is a Haunt builder procedure.

   SITE (<site>)
     A site object that defines all the properties of the website. See
     Haunt <site> objects for more information.

   POSTS (list of <post>)
     A list of post objects that represent articles from the blog. See
     Haunt <post> objects for more information.

   RETURN (list of <artifact> and <page>)
     A list of objects that represent the web resources of the
     application. See Haunt <artifact> and <page> objects for more
     information."
  (flatten
   (list (screenshots-overview-builder)
         (screenshots-builder)
         )))


;;;
;;; Helper builders.
;;;


(define (screenshots-builder)
  "Return a list of Haunt pages representing screenshot pages."
  (map
   (lambda (shot)
     (let ((context
            (list (cons "screenshot" shot)
                  (cons "screenshots" screenshots))))
       (serialized-artifact (path-join "screenshots"
                             (screenshot-slug shot)
                             "index.html")
                  (screenshot-t context)
                  sxml->html)))
   screenshots))


(define (screenshots-overview-builder)
  "Return a Haunt page representing the screenshots overview page."
  (serialized-artifact "screenshots/index.html"
             (screenshots-overview-t screenshots)
             sxml->html))