unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 2a42220412d17750147ef29fb99cbf42a7c953f4 1839 bytes (raw)
name: website/apps/videos/builder.scm 	 # note: path name is non-authoritative(*)

 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
 
;;; GNU Guix web site
;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Initially written by sirgazil who waives all
;;; copyright interest on this file.

(define-module (apps videos builder)
  #:use-module (apps aux web)
  #:use-module (apps videos data)
  #:use-module (apps videos templates video)
  #:use-module (apps videos templates video-list)
  #:use-module (apps videos utils)
  #:use-module (haunt html)
  #:use-module (haunt page)
  #:use-module (haunt utils)
  #:use-module (srfi srfi-1)
  #: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 <page>)
     A list of page objects that represent the web resources of the
     application. See Haunt <page> objects for more information."
  (flatten
   (list (video-list-builder)
         (videos-builder))))

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

(define (videos-builder)
  "Return a list of Haunt pages representing videos."
  (map-in-order
   (lambda (playlist)
     (map-in-order
      (lambda (previous video next)
        (make-page (video->url video)
                   (video-t previous video next)
                   sxml->html))
      (cons #f (drop-right playlist 1))
      playlist
      (append (cdr playlist) '(#f))))
   playlists))

(define (video-list-builder)
  "Return a Haunt page displaying all videos."
  (make-page (url-path-join "videos" "index.html")
             (video-list-t)
             sxml->html))

debug log:

solving 2a42220 ...
found 2a42220 in https://yhetil.org/guix-devel/20191022120504.7cyoc5x2exylpzrg@pelzflorian.localdomain/

applying [1/1] https://yhetil.org/guix-devel/20191022120504.7cyoc5x2exylpzrg@pelzflorian.localdomain/
diff --git a/website/apps/videos/builder.scm b/website/apps/videos/builder.scm
new file mode 100644
index 0000000..2a42220

Checking patch website/apps/videos/builder.scm...
Applied patch website/apps/videos/builder.scm cleanly.

index at:
100644 2a42220412d17750147ef29fb99cbf42a7c953f4	website/apps/videos/builder.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).