summaryrefslogtreecommitdiffstats
path: root/site/cleopatra/theme.org
blob: 3bba6b7a06ab76ef0234587c99344493aab10fd3 (plain)
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#+BEGIN_EXPORT html
<h1>Theming and Templating</h1>
#+END_EXPORT

#+BEGIN_SRC makefile :tangle theme.mk
SASS := site/style/main.sass
CSS := $(SASS:.sass=.css)

theme-build : ${SASS}
	@cleopatra echo Compiling  "${CSS}"
	@sassc --style=compressed --sass ${SASS} ${CSS}

soupault-build : theme-build

ARTIFACTS += ${CSS} ${SASS}
#+END_SRC

* Main HTML Template

#+BEGIN_SRC html  :tangle templates/main.html :noweb no-export
<html lang="en">
  <<head>>
  <<body>>
</html>
#+END_SRC

** ~<head>~

#+NAME: head
#+BEGIN_SRC html :noweb no-export
<head>
  <<encoding>>
  <<viewport>>
  <title></title>
  <<syncloading_html>>
  <<asyncloading_html>>
</head>
#+END_SRC

*** Encoding

#+NAME: encoding
#+BEGIN_SRC html
<meta charset="utf-8">
#+END_SRC

*** Viewport

#+NAME: viewport
#+BEGIN_SRC html
<meta name="viewport"
      content="width=device-width, initial-scale=1.0">
#+END_SRC

*** Assets Loading

#+NAME: syncloading_html
#+BEGIN_SRC html
<link rel="stylesheet" href="/style/main.css">
<link rel="icon" type="image/ico"  href="/img/merida.webp">
#+END_SRC

#+NAME: asyncloading_js
#+BEGIN_SRC js
let noscript = document.getElementById('asyncloading');
noscript.insertAdjacentHTML('beforebegin', noscript.innerText);
noscript.parentNode.removeChild(noscript);
#+END_SRC

#+NAME: asyncloading_html
#+BEGIN_SRC html
<noscript id="asyncloading">
  <link href="https://soap.coffee/+vendors/fira-code.2+swap/font.css"
     rel="stylesheet">
  <link href="https://soap.coffee/+vendors/et-book+swap/font.css"
     rel="stylesheet">
  <link href="https://soap.coffee/+vendors/katex.0.11.1+swap/katex.css"
     rel="stylesheet">
  <link href="https://soap.coffee/+vendors/fork-awesome.1.1.7+swap/css/fork-awesome.min.css"
     rel="stylesheet">
</nolink>
#+END_SRC

** ~body~

#+NAME: body
#+BEGIN_SRC html :noweb no-export
<body id="default">
  <nav>
    <ul>
      <li> <a href="/news">News</a></li>
      <li> <a href="/">Write-ups</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>
    <<asyncloading_js>>
  </script>
</body>
#+END_SRC

* Main SASS File

#+BEGIN_SRC sass :tangle site/style/main.sass
$bg-color: #2d2a2e
$bg-verbatim : #f4f4f4
$code-fg-color: #fcfcfa
$text-fg-color: #505050
$primary-color: black
$todo-bg: #e4d3b3
$todo-fg: #2f2b24
$remark-bg: #c5dbe2
$remark-fg: #4d575e

$sans-serif : sans-serif

$document-width : 33rem

a
    color : #557de8
a:visited
    color : #40599a

@mixin padding-centered($inc: 0rem)
    @media screen and (min-width : $document-width)
        padding-left : calc(50% - #{$document-width} / 2 - #{$inc})
        padding-right : calc(50% - #{$document-width} / 2 - #{$inc})
    @media screen and (max-width : $document-width)
        padding-left : 1rem
        padding-right : 1rem

@mixin margin-centered($inc: 0rem)
    @media screen and (min-width : $document-width)
        margin-left : calc(50% - #{$document-width} / 2 - #{$inc})
        margin-right : calc(50% - #{$document-width} / 2 - #{$inc})
    @media screen and (max-width : $document-width)
        margin-left : 1rem
        margin-right : 1rem

@mixin text-font
    font-family : et-book, serif

@mixin code-font($size : .9rem)
    font-family: 'Fira Code', monospace
    font-size: $size

@mixin code-block
    @include padding-centered
    @include code-font
    background : $bg-color
    color : $code-fg-color
    overflow-x : auto
    scrollbar-width : thin

@mixin verbatim-block
    @include padding-centered
    @include code-font
    background : $bg-verbatim
    overflow-x : auto
    scrollbar-width : thin

*
  box-sizing: border-box

html, body
    margin : 0
    padding : 0
    width : 100%
    height : 100%
    font-size : 115%
    @include text-font

body
    overflow-x : hidden

code, tt
    @include code-font

pre
    @include code-font

body#default
    nav
        @include margin-centered
        padding-top : 1rem
        padding-bottom : 1rem

        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-weight: bold

                a
                    text-decoration: none

    header
        text-align: center

        img
            text-align: center
            border-radius: 50%
            width: 150px

    main
        h1
            text-align: center

        h1, h2, h3, h4, h5, h6
            font-family : $sans-serif

            code, tt
                font-size: 100%

        h1, h2, h3, h4, h5, h6, p, summary
            @include padding-centered

        dl, ul, ol
            @include margin-centered

        .TODO
            background : $todo-bg
            color : $todo-fg
            padding-top : .1rem
            padding-bottom : .1rem
            margin-top : 1rem
            margin-bottom : 1rem

        @import coq, org

.index
    dt
        font-weight : bold
        color : $primary-color

    dd
        margin-left : 0
        margin-bottom : 1em

        ol
            margin-top: 0.3em

@import plugins

/* 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
#+END_SRC