8000 Include index file when cogging. · eknathk/complete-python-course@ad555bf · GitHub
[go: up one dir, main page]

Skip to content

Commit ad555bf

Browse files
committed
Include index file when cogging.
1 parent 4ed350b commit ad555bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

content.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ def get_grouped_build_sections(root: str = "build") -> dict[str, list]:
8585
def build_and_get_yaml_contents(build_path: str = "build"):
8686
# Delete contents of the build directory
8787
shutil.rmtree(build_path, ignore_errors=True)
88+
pathlib.Path(build_path).mkdir(parents=True, exist_ok=True)
89+
shutil.copyfile("course_contents/index.md", pathlib.Path(build_path) / "index.md")
8890
sections = get_all_sections_with_content()
8991
for section in sections:
9092
# Strip the leading numbers of the section folder
9193
old_section_name = section["index"]["full_path"].parent.name
9294
section_name = "_".join(old_section_name.split("_")[1:])
93-
# Create a directory in the build folder matching the section_name
9495
pathlib.Path(build_path, section_name).mkdir(parents=True, exist_ok=True)
96+
# Create a directory in the build folder matching the section_name
9597
# Copy the README.md file from the original section to the new directory
9698
shutil.copyfile(section["index"]["full_path"], pathlib.Path(build_path, section_name, "README.md"))
9799
# Copy the lecture folders to the new directory

0 commit comments

Comments
 (0)
0