guix-hpc.scm 3.96 KB
Newer Older
Ludovic Courtès's avatar
Ludovic Courtès committed
1 2 3 4 5 6 7
;;; This module is part of Guix-HPC and is licensed under the same terms,
;;; those of the GNU GPL version 3 or (at your option) any later version.
;;;
;;; Copyright © 2017 Inria

(define-module (guix-hpc)
  #:use-module (haunt page)
8
  #:use-module (haunt site)
Ludovic Courtès's avatar
Ludovic Courtès committed
9
  #:use-module (haunt html)
Ludovic Courtès's avatar
Ludovic Courtès committed
10 11
  #:use-module (haunt reader)
  #:use-module (haunt reader commonmark)
Ludovic Courtès's avatar
Ludovic Courtès committed
12
  #:use-module (srfi srfi-11)
13 14 15 16
  #:export (base-url
            image-url
            css-url
            post-url
Ludovic Courtès's avatar
Ludovic Courtès committed
17

Ludovic Courtès's avatar
Ludovic Courtès committed
18 19
            base-layout

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
            static-pages))

(define (base-url . location)
  (string-concatenate (cons "" location)))

(define (image-url location)
  (base-url "static/images" location))

(define (css-url location)
  (base-url "static/css" location))

(define (post-url post site)
  "Return the URL of POST, a Haunt blog post, for SITE."
  (base-url (site-post-slug site post) ".html"))

Ludovic Courtès's avatar
Ludovic Courtès committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

(define* (base-layout body #:key (title "Guix-HPC"))
  `((doctype "html")
    (html (@ (lang "en"))
          (head
           (meta (@ (http-equiv "Content-Type")
                    (content "text/html; charset=utf-8")))
           (link (@ (rel "icon")
                    (type "image/x-icon")
                    (href ,(image-url "/favicon.png"))))
           (link (@ (rel "stylesheet")
                    (href ,(css-url "/main.css"))
                    (type "text/css")
                    (media "screen")))
           (title ,title))
	  (body
           (div (@ (id "header"))
                (div (@ (id "header-inner")
                        (class "width-control"))
                     (img (@ (class "logo")
55 56 57
                             (src ,(image-url "/logo.png"))))
                     (div (@ (class "baseline"))
                          "Reproducible software deployment for high-performance computing.")))
Ludovic Courtès's avatar
Ludovic Courtès committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
           (div (@ (id "menubar")
                   (class "width-control"))
                (ul
                 (li (a (@ (href ,(base-url "about.html")))
                        "About"))
                 (li (a (@ (href "#")) "Who"))
                 (li (a (@ (href "#")) "Where"))
                 (li (a (@ (href ,(base-url "/news/feed.xml")))
                        (img (@ (alt "Atom feed")
                                (src ,(image-url "/feed.png"))))))))

           (div (@ (id "content")
                   (class "width-control"))
                (div (@ (id "content-inner"))
                     (article ,body)))

           (div (@ (id "collaboration"))
                (div (@ (id "collaboration-inner")
                        (class "width-control"))
77
                     (p "Guix-HPC is a collaboration between:")
Ludovic Courtès's avatar
Ludovic Courtès committed
78 79 80 81 82 83 84 85 86 87
                     (div (@ (class "members"))
                          (ul
                           (li (img (@ (alt "MDC")
                                       (src ,(image-url "/mdc.png")))))
                           (li (img (@ (alt "Inria")
                                       (src ,(image-url "/inria.png")))))
                           (li (img (@ (alt "UMC Utrecht")
                                       (src ,(image-url "/umcutrecht.png")))))))))
           (div (@ (id "footer-box")
                   (class "width-control"))
88 89
                (p (a (@ (href "https://gitlab.inria.fr/guix-hpc/website"))
                      "Source of this site")))))))
Ludovic Courtès's avatar
Ludovic Courtès committed
90

91

Ludovic Courtès's avatar
Ludovic Courtès committed
92 93 94 95 96 97 98
(define %cwd
  (and=> (assq-ref (current-source-location) 'filename)
         dirname))

(define read-markdown
  (reader-proc commonmark-reader))

Ludovic Courtès's avatar
Ludovic Courtès committed
99 100 101 102 103 104 105 106 107 108
(define (read-markdown-page file)
  "Read the CommonMark page from FILE.  Return its final SXML
representation."
  (let-values (((meta body)
                (read-markdown (string-append %cwd "/" file))))
    (base-layout `(div (@ (class "post"))
                       (div (@ (class "post-body")) ,body))
                 #:title (string-append "Guix-HPC — "
                                        (assoc-ref meta 'title)))))

Ludovic Courtès's avatar
Ludovic Courtès committed
109
(define (about-page)
Ludovic Courtès's avatar
Ludovic Courtès committed
110
  (read-markdown-page "about.md"))
Ludovic Courtès's avatar
Ludovic Courtès committed
111 112

(define (static-pages)
Ludovic Courtès's avatar
Ludovic Courtès committed
113
  (list (make-page "about.html" (about-page) sxml->html)))