-
Notifications
You must be signed in to change notification settings - Fork 38
/
mkNotes.sc
executable file
·33 lines (33 loc) · 1.09 KB
/
mkNotes.sc
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
#!/usr/bin/env amm
val notesDir = os.pwd / 'notes
val notes = os.list(notesDir).filter(_.ext == "ipynb").sortBy(_.last)
def nb(p: os.Path) = {
pprint.log(p.last)
os.proc("jupyter", "nbconvert", "--to", "html", "--output", (os.pwd / 'docs / 'notes / p.last).toString, p.relativeTo(os.pwd).toString).call()
}
notes.foreach(nb)
def item(p: os.Path) = {
val name = p.last
s"""<li><a href="$name.html">$name</a></li>"""
}
val allItems = notes.filter(_.last.startsWith("20")).sortBy(_.last).reverse.map(item).mkString("\n")
val index =
s"""
<html>
<head>
<title>ProvingGround Working Notebooks</title>
<link rel="icon" href="../IIScLogo.jpg">
<link href="../css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h2> ProvingGround Working Notebooks </h2>
<p> These are the working notes. Each one should import a jar with a short commit for replication</p>
<ul>
$allItems
</ul>
</div>
</body>
</html>
"""
os.write.over(os.pwd / 'docs / 'notes / "index.html", index)