-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.py
executable file
·40 lines (32 loc) · 906 Bytes
/
build.py
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
#!/usr/bin/env python
# Standard Library
import os
from pathlib import Path
# Third-Party Libraries
import pandoc
from plumbum import local, FG
cwd = Path.cwd()
# Build in subdirectories
for build_py in cwd.glob("*/**/build.py"):
dir = build_py.parent
print(build_py)
try:
os.chdir(dir)
local["./build.py"] & FG
finally:
os.chdir(cwd)
# Transform the README.md into a index.html
with open("README.md", mode="r", encoding="utf-8") as file:
README = file.read()
# Relative links (fork-friendly)
README = README.replace("https://boisgera.github.io/python-fr/", "")
doc = pandoc.read(README)
options = [
"--standalone",
"--css=css/style.css",
"--include-in-header=html/font.html",
"--include-in-header=html/copy-code.html",
"--variable=lang:fr",
"--no-highlight"
]
pandoc.write(doc, file="index.html", format="html", options=options)