From 25d51a3d0c5836ad86a158ab95751254af44a6b2 Mon Sep 17 00:00:00 2001 From: Mars Liu Date: Fri, 3 Dec 2021 15:54:09 +0800 Subject: [PATCH] fixed odd orders --- src/tree.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tree.py b/src/tree.py index ae5c7e5..b5a8cb2 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) -- GitLab