forked from awwx/evalto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
page.arc
116 lines (96 loc) · 1.98 KB
/
page.arc
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
(def text-content ()
(pr "HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Connection: close
")
(pr-cookies)
(prn))
;; todo once-only or something like it here would be nice
;; todo include html-content
(mac html-page (attrs . body)
(w/uniq a
`(let ,a ,attrs
(prn "<!DOCTYPE html>")
(tag html
(tag head
(prn "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">")
(aif (alref ,a 'title)
(tag title (pr-escaped it)))
(each cssref (alref ,a 'cssref)
(prn "<link rel=\"stylesheet\" type=\"text/css\" href=\"" cssref "\">"))
(each css (alref ,a 'css)
(prn "<style>")
(pr css)
(prn "</style>"))
(each jsref (alref ,a 'jsref)
(prn "<script src=\"" jsref "\"></script>"))
(each js (alref ,a 'js)
(prn "<script>")
(pr js)
(prn "</script>")))
(tag body
,@body)))))
(= css* "
body {
font-family: verdana;
margin: 0 2em;
}
h1 {
font-size: large;
font-weight: bold;
margin-bottom: 0.3em;
}
h2 {
font-weight: normal;
font-size: large;
margin-top: 1em;
}
h3 {
font-size: medium;
font-weight: bold;
margin-bottom: 0;
}
h4 {
font-style: italic;
margin-top: 1em;
margin-bottom: 0.5em;
}
p, ol, ul {
max-width: 40em;
}
li {
margin-bottom: 0.5em;
}
pre, code {
font-family: courier, monospace;
}
.codefont {
font-family: monospace;
font-size: 10pt;
white-space: pre-wrap;
}
pre {
margin: 0;
}
blockquote {
margin: 0 0 0 2em;
}
td {
vertical-align: top;
}
.pad {
padding: 0 0.5em 0 0.5em;
}
.green {
color: #5f5;
}
.red {
color: red;
}
")
(def header ()
(tag (div style "background-color: #ddd; padding: 0.2em 0.5em")
(map pr (intersperse " "
(join (list (tostring (link "eval.to" evalto-url*)))
(wiki-header-links)
(account-header-links))))))