def __init__(self, course_name, language, defaults): self.course_name = course_name self.language = language self.defaults = defaults self.docs = docs.DocCollection( keys=['level', 'slug'], synth={ 'slug': lambda d: docs.slugify(d.front_matter.get('title', None)) }) self.docs.load_dir(f'coursedata/course/{course_name}/docs-{language}') self._validated = False
def __init__(self, course_name, language, defaults): self.course_name = course_name self.language = language self.defaults = defaults self.course = load_yaml(f'coursedata/course/{course_name}/{language}.yaml').get('course') if not self.course: raise RuntimeError(f'File should have top-level "course" field: coursedata/course/{course_name}/{language}.yaml') self.validate_course() self.docs = docs.DocCollection(keys=['level', 'slug'], synth={ 'slug': lambda d: docs.slugify(d.front_matter.get('title', None)) }) self.docs.load_dir(f'coursedata/course/{course_name}/docs-{language}')