提交 31050f0c 编写于 作者: L luxin

增加 subtree 字段

上级 dffc86aa
......@@ -46,3 +46,7 @@ CSDN 技能树结构(章节、元信息、习题)解释器,支持技能树
- 增加 FAQ
- 修正 `requirements.txt` 包拼写错误
### 0.0.13
- 增加 subtree 字段
......@@ -71,7 +71,8 @@ def ensure_config(path):
node = {"keywords": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0}
"group": 0,
"subtree": ""}
dump_json(config_path, node, exist_ok=True, override=False)
return node
else:
......@@ -132,7 +133,8 @@ class TreeWalker:
"children": [],
"keywords_must": root.get("keywords_must", []),
"keywords_forbid": root.get("keywords_forbid", []),
"group": root.get("group", 0)
"group": root.get("group", 0),
"subtree": root.get("subtree", "")
}
self.tree[root["tree_name"]] = root_node
self.load_levels(root_node)
......@@ -189,7 +191,8 @@ class TreeWalker:
"children": [],
"keywords_must": config.get("keywords_must", []),
"keywords_forbid": config.get("keywords_forbid", []),
"group": config.get("group", 0)
"group": config.get("group", 0),
"subtree": config.get("subtree", "")
}
}
......@@ -243,7 +246,8 @@ class TreeWalker:
"node_id": self.gen_node_id(),
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 0,
"subtree": ""
}
dump_json(config_path, config, exist_ok=True, override=True)
else:
......@@ -276,7 +280,8 @@ class TreeWalker:
"keywords": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 0,
"subtree": ""
}
dump_json(config_path, config, exist_ok=True, override=True)
else:
......@@ -296,7 +301,8 @@ class TreeWalker:
"export": [],
"keywords_must": [],
"keywords_forbid": [],
"group": 0
"group": 0,
"subtree": ""
}
dump_json(config_path, config, exist_ok=True, override=True)
else:
......@@ -347,7 +353,8 @@ class TreeWalker:
"children": [],
"keywords_must": config.get("keywords_must", []),
"keywords_forbid": config.get("keywords_forbid", []),
"group": config.get("group", 0)
"group": config.get("group", 0),
"subtree": config.get("subtree", "")
}
}
return num, result
......@@ -362,7 +369,8 @@ class TreeWalker:
"children": config.get("children", []),
"keywords_must": config.get("keywords_must", []),
"keywords_forbid": config.get("keywords_forbid", []),
"group": config.get("group", 0)
"group": config.get("group", 0),
"subtree": config.get("subtree", "")
}
}
# if "children" in config:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册