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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
#+BEGIN_EXPORT html
<h1>Theming and Templating</h1>
#+END_EXPORT
* Main HTML Template
#+NAME: js_lazyloading
#+BEGIN_SRC js
let noscript = document.getElementById('lazyloading');
let resources = noscript.innerText.split('\n');
for (var ix in resources) {
noscript.insertAdjacentHTML('beforebegin', resources[ix]);
}
#+END_SRC
#+NAME: html_lazyloading
#+BEGIN_SRC html
<noscript id="lazyloading">
<link rel="stylesheet" href="/vendors/fira-code.2+swap/font.css">
<link rel="stylesheet" href="/vendors/et-book+swap/font.css">
<link rel="stylesheet" href="/vendors/katex.0.11.1+swap/katex.css">
<link rel="stylesheet"
href="/vendors/fork-awesome.1.1.7+swap/css/fork-awesome.min.css">
</nolink>
#+END_SRC
#+BEGIN_SRC html :tangle templates/main.html :noweb tangle
<html lang="en">
<head>
<meta charset="utf-8">
<title> <!-- set automatically, see soupault.conf --> </title>
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/style/main.css">
<link rel="icon" type="image/ico" href="/img/merida.webp">
<<html_lazyloading>>
</head>
<body id="default">
<nav>
<ul>
<li> <a href="/news">News</a></li>
<li> <a href="/posts">Write-ups</a></li>
<li> <a href="/">About</a></li>
</ul>
</nav>
<header>
<img src="/img/merida.webp"
alt="Merida in the movie Ralph 2.0" />
</header>
<main>
<!-- your page content will be inserted here,
see the content_selector option in soupault.conf -->
</main>
<script>
<<js_lazyloading>>
</script>
</body>
</html>
#+END_SRC
* Main SASS File
#+BEGIN_SRC sass :tangle site/style/main.sass
$bg-color: #efece3
$code-fg-color: black
$text-fg-color: #505050
$primary-color: black
$todo-bg: #e4d3b3
$todo-fg: #494130
$remark-bg: #c5dbe2
$remark-fg: #4d575e
*
box-sizing: border-box
body, html
width: 100%
height: 100%
padding: 0
margin: 0
font-size: 100%
background: $bg-color
color: $text-fg-color
font-family: 'et-book', serif
h1, h2, h3, h4, h5, a[href]
color: $primary-color
h1, h2, h3, h4, h5
font-family: sans-serif
h1
text-align: center
/* default */
body#default
overflow-x: hidden
nav
padding-top: 1em
padding-bottom: 1em
width: 100%
ul
padding: 0
margin: 0
width: 100%
display: flex
flex-direction: row
justify-content: center
list-style-type: none
li
padding-left: .5em
padding-right: .5em
text-transform: uppercase
font-family: sans-serif
font-size: 130%
font-weight: bold
a
text-decoration: none
header
text-align: center
img
text-align: center
border-radius: 50%
width: 125px
main
max-width: 600px
margin: auto
padding: 0em 1em 1em 1em
font-size: 130%
body#default main .code, code, pre, .inlinecode, tt
font-family: 'Fira Code', monospace
color: $code-fg-color
font-size: 75%
body#default
main
@import coq, org
.TODO
background: $todo-bg
color: $todo-fg
.REMARK
background: $remark-bg
color: $remark-fg
.TODO, .REMARK
padding: 1em 1em 1em 1em
p
margin: 0
p:not(:list-child)
margin-bottom: 1em
/* VCARD (index.html) */
body#vcard
display: flex
align-items: center
flex-direction: column
font-size: 125%
article
max-width: 400px
width: 80%
margin: auto
img
display: block
border-radius: 50%
width: 175px
margin: auto
margin-bottom: 3em
h1
color: $primary-color
font-size: 300%
text-align: center
nav dt
font-weight: bold
a
color: $primary-color
/* indexes */
.index
dt
font-weight: bold
color: $primary-color
dd
margin-left: 0
margin-bottom: 1em
ol
margin-top: 0.3em
@import plugins
#+END_SRC
#+BEGIN_SRC makefile :tangle theme.mk
SASS := site/style/main.sass
CSS := $(SASS:.sass=.css)
${CSS} : ${SASS} ${GENSASS}
@echo " compile $<"
@sassc --style=compressed --sass $< $@
CONTENTS += ${CSS}
#+END_SRC
|