-
Notifications
You must be signed in to change notification settings - Fork 3
/
templates.rkt
149 lines (130 loc) · 4.74 KB
/
templates.rkt
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#lang scribble/html
@; Provides HTML templates and common variables for pages
@provide[
PROJECT-NAME
AWARD-HREF
AWARD-NUMBER
;; constants
---
;; mdash
page
;; (-> Natural . Any Html)
(all-from-out "templates/datatypes.rkt")
(all-from-out "templates/universities.rkt")
(all-from-out "templates/people.rkt")
(all-from-out "templates/publications.rkt")
(all-from-out "templates/venues.rkt")
]
@require[
(only-in file/glob glob)
(only-in racket/date current-date)
scribble/html
web-server/templates
racket/string
"templates/datatypes.rkt"
"templates/misc-scripts.rkt"
"templates/people.rkt"
"templates/publications.rkt"
"templates/universities.rkt"
"templates/venues.rkt"
]
@; =============================================================================
@(define PROJECT-NAME "Gradual Typing Across the Spectrum")
@(define AWARD-HREF "http://www.nsf.gov/awardsearch/showAward?AWD_ID=1518844")
@(define AWARD-NUMBER "SHF 1518844")
@(define BODY-ID "top")
@(define PAGE-TITLE* '("Home" "About" "Projects" "Benchmarks" "People" "Contact"))
@(define --- @literal{—})
@; -----------------------------------------------------------------------------
@(define current-logo-number
(let ([num-logos (length (glob "images/logo/*.ico"))])
(lambda ()
(modulo (date-hour (current-date)) num-logos))))
@(define (header)
@head{
@meta[charset: "UTF-8"]
@meta[name: "description" contents: PROJECT-NAME]
@meta[name: "keywords" content: "programming, language, gradual, typing"]
@title[PROJECT-NAME]
@stylesheets["css/bootstrap.min.css"
"css/animate.css"
"css/custom.css"]
@link[href: "http://fonts.googleapis.com/css?family=Ubuntu:300"
rel: "stylesheet"
type: "text/css"]
@link[href: "http://fonts.googleapis.com/css?family=PT+Sans"
rel: "stylesheet"
type: "text/css"]
@favicons["16x16"] @; "32x32" "96x96"]
@script[src: "js/wow.min.js"]
@scripts["jquery.min" "bootstrap.min" "custom" "stellar"]})
@(define (stylesheets . href*)
(for/list ([href (in-list href*)])
@link[rel: "stylesheet" href: href]))
@(define (favicons . size*)
(for/list ([size (in-list size*)])
@link[rel: "shortcut icon"
type: "image/x-icon"
size: size
href: (format "images/logo/gtp-~a.ico" (current-logo-number))]))
@(define (scripts . src*)
(for/list ([src (in-list src*)])
@script[type: "text/javascript" src: (format "js/~a.js" src)]))
@(define (sponsors page-title)
@div[id: "sponsors" class: "col-md-12"]{
@center{
@h4[class: "red-back"
(if (string=? page-title (car PAGE-TITLE*))
(format "Supported by the National Science Foundation (~a)" AWARD-NUMBER)
"")]}})
@(define (footer . val*)
(apply element/not-empty 'footer val*))
@(define (make-footer)
@footer[class: "col-md-12"]{
@div[class: "container text-center"]{
@hr{}
@div[class: "copyright"]{
@p[class: "text-center"]{
@literal{©} Copyright Programming Research Laboratory 2016-2017
| made by @a[href: "http://www.catchexception.cz/" target: "_blank"]{ Catchexception s.r.o.}
| source on @a[href: "https://github.com/nuprl/gtp"]{GitHub}}}
@a[href: (string-append "#" BODY-ID)
title: "To Top"]{
@span[class: "glyphicon glyphicon-chevron-up"]}}})
@(define (nav current-page)
@div[id: "menu"
class: "menu-fixed"]{
@span[id: "menu-icon"]{
@span[class: "glyphicon glyphicon-menu-hamburger"]{}}
@ul[(for/list ([p (in-list PAGE-TITLE*)]
[i (in-naturals 1)])
@li[class: (if (string=? p current-page) "active" "")
data-src: (format "./images/menu/item_~a.png" i)]{
@a[href: (if (string=? p "Home")
"index.html"
(string-append (string-downcase p) ".html"))
p]})]})
@(define (page n . content)
(unless (exact-nonnegative-integer? n)
(raise-argument-error 'page "Natural number" n))
(define page-title (list-ref PAGE-TITLE* n))
(list
@doctype{html}
@html[lang: "en"]{
@header[]
@div[class: "body" data-stellar-background-ratio: "1.5"]
@div[class: "main-header-container"]{
@div[class: "shadow-back"]{
@div[class: "main-logo"]{
@img[class: "img-responsive pull-left"
alt: ""
src: (format "images/logo/gtp-~a.png" (current-logo-number))]}
@div[class: "main-header"]{
@h1[PROJECT-NAME]}}}
@body[id: BODY-ID]{
@nav[page-title]
@div[class: "body-content"]{
@div[id: "content"]{@content}
@sponsors[page-title]
@make-footer[]
@misc-scripts[] }}}))