forked from nuprl/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.rkt
162 lines (143 loc) · 5.57 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
150
151
152
153
154
155
156
157
158
159
160
161
162
#lang scribble/html
@provide[
header
navbar
subpage-title
person
comment
footer
url
mailto
NuPRL-TWITTER
NuPRL-GITHUB
]
@require[
(only-in racket/list add-between)
]
@; -----------------------------------------------------------------------------
@(define NuPRL-TWITTER "https://twitter.com/neu_prl")
@(define NuPRL-GITHUB "https://github.com/nuprl")
@(define (comment . content)
@literal[@list[" <!-- " content " --> "]])
@(define <!-- comment)
@(define (header title-str)
@head{
@meta[charset: "utf-8"]
@meta[http-equiv: "X-UA-Compatible" content: "IE=edge"]
@meta[name: "viewport" content: "width=device-width, initial-scale=1"]
@; Be friendly to embedding on social media platforms
@meta[property: "og:title" content: "NEU PRL"]
@meta[property: "og:description"
content: "Programming Research Laboratory @ Northeastern University"]
@meta[property: "og:image" content: "img/prl-bg.png"]
@title{@|title-str| - Programming Research Laboratory - Northeastern University}
@<!--{Bootstrap}
@link[href: "css/bootstrap.min.css" rel: "stylesheet"]
@<!--{Custom css}
@link[href: "css/custom.css" rel: "stylesheet"]
@<!--{Fonts}
@link[href: "https://fonts.googleapis.com/css?family=Ubuntu:300"
rel: "stylesheet"
type: "text/css"]
@link[href: "https://fonts.googleapis.com/css?family=PT+Sans"
rel: "stylesheet"
type: "text/css"]
@<!--{196x196 pixels in size.}
@link[rel: "icon" href: "img/favicon.png"] })
@(define (footer)
@list{
@element/not-empty['footer class: "footer"]{
@p[@twitter-follow-button["neu_prl" "Follow the PRL"]]
@p{© Copyright Programming Research Laboratory 2015-2021 | made by Catchexception s.r.o. | source on @a[href: "https://github.com/nuprl/website"]{GitHub}}
@a[class: "pn-top pn-dark" href: "#pn-top"]{
@img[src: "img/up-arrow.png" alt: "top"]}}
@<!--{jQuery (necessary for Bootstrap's JavaScript plugins)}
@script[src: "https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"]
@<!--{Include all compiled plugins (below), or include individual files as needed}
@script[src: "js/bootstrap.min.js"]
@<!--{Custom scripts}
@script[src: "js/custom.js"]
@script[src: "js/analytics.js"]
})
@; Copied from `frog/widgets.rkt`
@(define (twitter-follow-button name label)
@list[
@a[href: (string-append "https://twitter.com/" name)
class: "twitter-follow-button"
data-show-count: "false"
data-lang: "en" label]
@script[type: "text/javascript" @literal|{
!function(d,s,id){
var js,fjs=d.getElementsByTagName(s)[0];
if(!d.getElementById(id)){
js=d.createElement(s);
js.id=id;
js.src="https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
}|]])
@(define nav-template ; (Listof (List String String))
'(("./" . "Home")
("people.html" . "People")
("teaching.html" . "Teaching")
("seminars.html" . "Seminars")
("software.html" . "Software")
("publications.html" . "Publications")
("new-members.html" . "New Members")
("contact.html" . "Contact")
("blog/index.html" . "Blog")))
@(define (navbar current-page)
(define rendered-nav-elements
(for/list ([title-pair (in-list nav-template)])
(if (string=? (cdr title-pair) current-page)
@li[role: "presentation" class: "active"]{@a[href: "#"]{@cdr[title-pair]}}
@li[role: "presentation"]{@a[href: @car[title-pair]]{@cdr[title-pair]}})))
@element/not-empty['nav class: "navbar navbar-inverse"]{
@div[class: "container"]{
@div[class: "row"]{
@div[class: "navbar-header"]{
@button[type: "button" class: "navbar-toggle collapsed" data-toggle: "collapse" data-target: "#navbar" aria-expanded: "false" aria-controls: "navbar"]{
@span[class: "sr-only"]{Toggle navigation}
@span[class: "icon-bar"]
@span[class: "icon-bar"]
@span[class: "icon-bar"]}}
@div[id: "navbar" class: "navbar-collapse collapse"]{
@ul[class: "nav navbar-nav" rendered-nav-elements] }}}})
@(define (subpage-title title)
@div[class: "jumbotron subpages"]{
@div[class: "container"]{
@div[class: "row"]{
@div[class: "col-md-12"]{
@h1[title]}}}})
@; website should include https or http
@; should figure out a nice interface so it doesn't display the protocol on the page.
@(define (person #:name name
#:title title
#:e-mail e-mail
#:website [website #f]
#:history history
#:img img-file
. bio)
@div[class: "row pn-person"]{
@div[class: "col-md-12 pn-row-eq-height"]{
@div[class: "col-md-3 pn-photo"]{
@div[class: "img-wrapper"]{
@img[src: @format["img/~a" img-file] title: name alt: name]}}
@div[class: "col-md-9"]{
@div[class: "col-md-4 pn-contact"]{
@span[class: "pn-name" name]
@br{}
@|title|
@br{}
@a[href: (format "mailto:~a" e-mail) e-mail]
@br{}
@a[href: website website]}
@div[class: "col-md-5 pn-muted col-md-offset-3"]{
@add-between[history @br{}]}
@div[class: "col-md-12 pn-bio"]{
@p{@|bio|}}}}})
@(define (url www)
@a[href: www www])
@(define (mailto email)
@a[href: (string-append "mailto:" email) (tt email)])