-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender.py
More file actions
35 lines (27 loc) · 852 Bytes
/
render.py
File metadata and controls
35 lines (27 loc) · 852 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
#!/usr/bin/python3
from pathlib import Path
import os.path
import os
import markdown
ROOT = Path("pull-requests")
TARGET = Path("public")
file: Path
DATA_PATHS = [Path("css"), Path("js")]
for root in DATA_PATHS:
for file in root.rglob('*'):
if file.name.startswith("."):
continue
if file.is_file():
out_file = TARGET / file
out_file.parent.mkdir(exist_ok=True, parents=True)
os.link(file, out_file)
for file in ROOT.rglob('*'):
if file.name.startswith("."):
continue
if file.is_file():
out_file = TARGET / file.relative_to(ROOT)
if file.stem == 'md': # found markdown
markdown.markdownFromFile(input=file, output=str)
else:
out_file.parent.mkdir(exist_ok=True, parents=True)
os.link(file, out_file)