MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / process

Function process

docs/website/scripts/split_courses.py:226–240  ·  view source on GitHub ↗
(source: Path)

Source from the content-addressed store, hash-verified

224
225
226def process(source: Path):
227 text = source.read_text(encoding="utf-8")
228 front, body = split_frontmatter(text)
229 meta = parse_meta(front)
230 slug = meta.get("slug", source.stem)
231 title = meta.get("title", source.stem)
232 treat_h2_as_lessons = slug == "course-01-java-for-mobile-devices"
233
234 intro, modules, hero_line = parse_course(body, treat_h2_as_lessons)
235 lessons = [lesson for module in modules for lesson in module.lessons]
236
237 write_lessons(slug, title, lessons)
238 write_hub(source, meta, intro, modules, hero_line)
239
240 print(f"{source.name}: generated {len(lessons)} lesson pages in courses/{slug}/")
241
242
243def main():

Callers 1

mainFunction · 0.85

Calls 6

parse_metaFunction · 0.85
parse_courseFunction · 0.85
write_lessonsFunction · 0.85
write_hubFunction · 0.85
split_frontmatterFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected