(source: Path)
| 224 | |
| 225 | |
| 226 | def 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 | |
| 243 | def main(): |
no test coverage detected