-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.jsonnet
42 lines (38 loc) · 1.01 KB
/
main.jsonnet
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
local c = import 'coursonnet.libsonnet';
local pages = import 'lessons/lessons.jsonnet';
local navMixin = function(pages, i)
(
if i > 0
then '<span class="nav previous">[« previous](%s.html)</span> ' % pages[i - 1].slug
else ''
)
+ '<span class="nav index">[index](index.html)</span>'
+ (
if i < (std.length(pages) - 1)
then ' <span class="nav next">[next »](%s.html)</span>' % pages[i + 1].slug
else ''
)
+ '\n';
local about = (import 'lessons/about.jsonnet').render['about.md'];
function(nav=false)
(import 'lessons/index.jsonnet').render
{
'about.md':
if nav
then
'<span class="nav index">[index](index.html)</span>\n'
+ about
+ '<span class="nav index">[index](index.html)</span>\n'
else about,
}
+ {
[pages[i].filename]:
if nav
then
navMixin(pages, i)
+ pages[i].render
+ navMixin(pages, i)
else
pages[i].render
for i in std.range(0, std.length(pages) - 1)
}