Skip to content

Commit 4e83ecd

Browse files
committed
fix contrib from a course file name
1 parent 94d347e commit 4e83ecd

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

contrib/review_run_slides

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ def run_watch(run_id, course):
122122
return r == Artifact
123123

124124

125+
def capitalize_words(s):
126+
upper = True
127+
r = ""
128+
for c in s:
129+
if upper:
130+
r += c.upper()
131+
else:
132+
r += c.lower()
133+
upper = c == " "
134+
return r
135+
136+
125137
def main():
126138
ap = ArgumentParser(description=script_description)
127139
ap.add_argument("course", nargs="?",
@@ -151,14 +163,15 @@ def main():
151163
# option 4: we read the course as if it was provided from the command line
152164
# falling back to option 1 or 2
153165
with open(single, "rt") as f:
154-
course = f.readlines()[0]
166+
course = Path("courses") / f.read().splitlines()[0]
155167

156168
def artifact_to_downloaded_dir(artifact_name):
157169
return OUT / artifact_name
158170

159171
def course_file_to_artifact(p : Path):
172+
ext_name = capitalize_words(p.with_suffix("").name.replace("_", " "))
160173
with open(p.parent / "course.toml", "rt") as f:
161-
return toml.load(f)["name"]
174+
return toml.load(f)["name"] + f" - {ext_name}"
162175

163176
def course_file_to_pdf_name(downloaded_dir : Path, p : Path):
164177
return downloaded_dir / p.with_suffix(".pdf").name

0 commit comments

Comments
 (0)