-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.nim
30 lines (25 loc) · 861 Bytes
/
index.nim
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
import nimib, nimib / [paths, gits], os, strutils, strformat
nbInit
var
listOfDrafts: string = ""
link: string = ""
for file in walkDirRec(nbHomeDir):
# echo getFileInfo(file).id.repr
if not file.endswith(".html") or file.name.startsWith("index") or (not file.isGitTracked):
# echo file.repr, " ", file.isGitTracked
continue
link = file.relPath.replace(r"\", "/")
echo "adding link: ", link
when defined(nblogRerun):
let cmd = "nim r " & link.replace(".html", ".nim")
echo "executing " & cmd
if execShellCmd(cmd) != 0:
echo cmd & " FAILED"
listOfDrafts.add(&"* [{link}]({link})\n")
nbText: """# Dimitri Lesnoff's blog
A blog about the Nim language. You can find some of my programs and tutorials.
""" & listOfDrafts
nbText: """
based on [Pietro Peterlongo's blog](https://pietroppeter.github.io/nblog).
"""
nbSave