diff --git a/src/tree.py b/src/tree.py index ae5c7e5861641fa56461104badcfefcaecc8412a..b5a8cb26891d2283019c0347bc3bb1b5bdfef96f 100644 --- a/src/tree.py +++ b/src/tree.py @@ -306,13 +306,23 @@ class TreeWalker: def ensure_exercises(self, section_path): config = self.ensure_section_config(section_path) + flag = False for e in os.listdir(section_path): base, ext = os.path.splitext(e) _, source = os.path.split(e) if ext != ".md": continue - meta_path = os.path.join(section_path, base + ".json") + mfile = base + ".json" + meta_path = os.path.join(section_path, mfile) self.ensure_exercises_meta(meta_path, source) + export = config.get("export", []) + if mfile not in export: + export.append(mfile) + flag = True + config["export"] = export + + if flag: + dump_json(os.path.join(section_path, "config.json"), config, True, True) for e in config.get("export", []): full_name = os.path.join(section_path, e)