Skip to content

Commit

Permalink
refine build script and style
Browse files Browse the repository at this point in the history
  • Loading branch information
geniucker-dev committed Jan 8, 2025
1 parent 79c5bc5 commit 7d86463
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
23 changes: 20 additions & 3 deletions .github/scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,26 @@ def generate_md(course: str, filelist_texts: str, readme_path: str):
with open('docs/index.md', 'w') as file:
file.writelines(mainreadme_lines)

shutil.copytree('assets', 'docs/assets', dirs_exist_ok=True)

os.system('mkdocs build')
# generate nav in mkdocs.yml
with open('mkdocs.yml', 'r') as file:
mkdocs_lines = file.readlines()
mkdocs_new = mkdocs_lines.copy() + [
'nav:\n',
' - 首页: index.md\n'
]
for course in courses:
mkdocs_new.append(" - {}: {}\n".format(course, "{}.md".format(course)))
with open('mkdocs.yml', 'w') as file:
file.writelines(mkdocs_new)

try:
shutil.copytree('assets', 'docs/assets', dirs_exist_ok=True)

os.system('python3 -m mkdocs build')
finally:
# restore mkdocs.yml
with open('mkdocs.yml', 'w') as file:
file.writelines(mkdocs_lines)

for course in courses:
move_files(course)
2 changes: 1 addition & 1 deletion Math285/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Math285:Introduction to Differential Equations
# Math285: Introduction to Differential Equations

老白出品微分方程,比241学起来简单许多,建议配合257一起食用
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ extra:
- icon: material/forum
link: https://www.cc98.org/topic/5802442
- icon: fontawesome/solid/paper-plane
link: mailto:me@geniucker.top
link: mailto:me@geniucker.com

0 comments on commit 7d86463

Please sign in to comment.