This commit is contained in:
Bagatur
2023-11-14 09:30:53 -08:00
parent f6e4c062f6
commit 2ff405df2a
12 changed files with 160 additions and 218 deletions

View File

@@ -1,15 +1,16 @@
import glob
import os
from pathlib import Path
import re
import shutil
from pathlib import Path
TEMPLATES_DIR = Path(os.path.abspath(__file__)).parents[2] / "templates"
DOCS_TEMPLATES_DIR = Path(os.path.abspath(__file__)).parents[1] / "docs" / "templates"
readmes = list(glob.glob(str(TEMPLATES_DIR) + "/*/README.md"))
destinations = [readme[len(str(TEMPLATES_DIR)) + 1 : -10] + ".md" for readme in readmes]
destinations = [readme[len(str(TEMPLATES_DIR)) + 1:-10] + ".md" for readme in readmes]
for source, destination in zip(readmes, destinations):
full_destination = DOCS_TEMPLATES_DIR / destination
shutil.copyfile(source, full_destination)
@@ -32,3 +33,4 @@ with open(TEMPLATES_INDEX_DESTINATION, "r") as f:
content = re.sub("\]\(\.\.\/", "](/docs/templates/", content)
with open(TEMPLATES_INDEX_DESTINATION, "w") as f:
f.write(sidebar_hidden + content)