-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathserve_docs.py
More file actions
36 lines (27 loc) · 896 Bytes
/
serve_docs.py
File metadata and controls
36 lines (27 loc) · 896 Bytes
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
import just
import livereload
import portray
NDF_PATH = "nostalgia/ndf.py"
def ignore(x):
return "lycheck" in x
def replace_ndf_class():
ndf_replace = "class NDF:"
original = just.read(NDF_PATH)
ndf = [x for x in original.split("\n") if x.startswith("class NDF")][0]
just.write(original.replace(ndf, ndf_replace), NDF_PATH)
return original
def render_as_html():
# remove base pandas from documentation
original_ndf = replace_ndf_class()
try:
portray.as_html(overwrite=True)
except KeyboardInterrupt:
print("Exiting")
# put pandas class back in
finally:
just.write(original_ndf, NDF_PATH)
server = livereload.Server()
server.watch("README.md", render_as_html, ignore=ignore)
server.watch("docs/**", render_as_html, ignore=ignore)
server.watch("docs/**/*.md", render_as_html, ignore=ignore)
server.serve(root="site")