-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-docs.dt
executable file
·57 lines (47 loc) · 1.18 KB
/
gen-docs.dt
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
#!/usr/bin/env dt
# Don't expose any commands defined later in the file.
defs \FROZEN_DEFS :
[quote \do doin] \eval def
# TODO: Why don't multiline strings work?
[ "<!doctype html>"
"<html>"
"<head>"
"<title>dt: standard library</title>"
"<link rel='stylesheet' href='//cdn.jsdelivr.net/npm/hack-font@3/build/web/hack.css'>"
"<link rel='stylesheet' href='style.css'>"
"</head>"
"<body>"
"<div id='wide-strip'>"
"<header><center><a href='/'>"
"<h1 id='logo'>dt</h1>"
"<h2><pre>duct tape for your unix pipes</pre></h2>"
"</a></center></header>"
"<main>"
"<hr>"
["<center><h2>dt " version " standard library</h2></center>"] eval "" join
"<table id='stdlib'>"
] eval
[ "<" split "<" join
">" split ">" join
] \html-escape def
[[cmd]:
"<tr>"
"<td class='green'>" cmd "</td>"
"<td>" cmd usage html-escape "</td>"
"</tr>"
] \cmd-row def
FROZEN_DEFS
["dt/" starts-with? not] filter
[\cmd-row doin "" join] map
"\n " join
push
[ "</table>"
"</main>"
"</div>"
"</body>"
"</html>"
] concat
"\n" join
\html :
html "stdlib.html" writef
html ["archive/stdlib-"] version push ".html" push "" join writef