File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff 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+
125137def 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
You can’t perform that action at this time.
0 commit comments