提交 5d150cd3 编写于 作者: M Mars Liu

fixed odd orders

上级 6180882a
...@@ -101,6 +101,7 @@ class TreeWalker: ...@@ -101,6 +101,7 @@ class TreeWalker:
section_title = list(section_node.keys())[0] section_title = list(section_node.keys())[0]
full_path = os.path.join(chapter_path, f"{index + 1}.{section_title}") full_path = os.path.join(chapter_path, f"{index + 1}.{section_title}")
if os.path.isdir(full_path): if os.path.isdir(full_path):
self.check_section_keywords(full_path)
self.ensure_exercises(full_path) self.ensure_exercises(full_path)
tree_path = os.path.join(self.root, "tree.json") tree_path = os.path.join(self.root, "tree.json")
...@@ -309,3 +310,9 @@ class TreeWalker: ...@@ -309,3 +310,9 @@ class TreeWalker:
dump_json(full_name, exercise, True, True) dump_json(full_name, exercise, True, True)
else: else:
id_set.add(exercise["exercise_id"]) id_set.add(exercise["exercise_id"])
def check_section_keywords(self, full_path):
config = self.ensure_section_config(full_path)
if not config.get("keywords", []):
self.logger.error(f"节点 [{full_path}] 的关键字为空,请修改配置文件写入关键字")
sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册