“eac5a0aa0c8c02d8aaac3481971ca29f4995181d”上不存在“doc/v2/design/git@gitcode.net:RobotFutures/Paddle.git”
提交 b70a3db8 编写于 作者: L luxin

add title field for config files

上级 66b55577
...@@ -33,5 +33,6 @@ ...@@ -33,5 +33,6 @@
], ],
"export": [ "export": [
"helloworld.json" "helloworld.json"
] ],
"title": "C语言发展史"
} }
\ No newline at end of file
...@@ -82,5 +82,6 @@ ...@@ -82,5 +82,6 @@
"export": [ "export": [
"features.json" "features.json"
], ],
"node_id": "c-946fc2eeba644ecf93e68974bf69f42a" "node_id": "c-946fc2eeba644ecf93e68974bf69f42a",
"title": "C语言特点"
} }
\ No newline at end of file
...@@ -70,7 +70,8 @@ ...@@ -70,7 +70,8 @@
} }
], ],
"export": [ "export": [
"standard.json" "standard.json"
], ],
"node_id": "c-3a6b78e1a4804917a5d48231f0cd87ea" "node_id": "c-3a6b78e1a4804917a5d48231f0cd87ea",
"title": "C语言标准"
} }
\ No newline at end of file
...@@ -95,7 +95,8 @@ ...@@ -95,7 +95,8 @@
} }
], ],
"export": [ "export": [
"compiler.json" "compiler.json"
], ],
"node_id": "c-be9d40c8fc0e49c9bbc1e3a0b60b7960" "node_id": "c-be9d40c8fc0e49c9bbc1e3a0b60b7960",
"title": "编程机制"
} }
\ No newline at end of file
{ {
"node_id": "c-ff93d18873424490849cdcf2ca01a48b", "node_id": "c-ff93d18873424490849cdcf2ca01a48b",
"keywords": [ "keywords": [
"概述", "概述",
"C语言概述", "C语言概述",
"C语言" "C语言"
] ],
"title": "C语言概述"
} }
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"children": [], "children": [],
"export": [ "export": [
"variables.json" "variables.json"
] ],
"title": "变量"
} }
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"export": [ "export": [
"constants.json" "constants.json"
], ],
"node_id": "c-d3cd094b74334fa3b123b896788aa1ca" "node_id": "c-d3cd094b74334fa3b123b896788aa1ca",
"title": "常量"
} }
\ No newline at end of file
...@@ -49,5 +49,6 @@ ...@@ -49,5 +49,6 @@
"export": [ "export": [
"basic_data_types.json" "basic_data_types.json"
], ],
"node_id": "c-4fd1baa5eb72451aa52e5ef801376f6f" "node_id": "c-4fd1baa5eb72451aa52e5ef801376f6f",
"title": "基本数据类型"
} }
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
], ],
"children": [], "children": [],
"export": [], "export": [],
"node_id": "c-c7ef387bd4bf4bd0a87d1886e66160c5" "node_id": "c-c7ef387bd4bf4bd0a87d1886e66160c5",
"title": "数据类型"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"children": [], "children": [],
"export": [ "export": [
"assignment_op.json" "assignment_op.json"
] ],
"title": "赋值运算符与表达式"
} }
\ No newline at end of file
...@@ -82,5 +82,6 @@ ...@@ -82,5 +82,6 @@
"export": [ "export": [
"arithmetic_op.json" "arithmetic_op.json"
], ],
"node_id": "c-e985fb409a3a43798aa3103cebe813e3" "node_id": "c-e985fb409a3a43798aa3103cebe813e3",
"title": "算术运算符与表达式"
} }
\ No newline at end of file
...@@ -72,5 +72,6 @@ ...@@ -72,5 +72,6 @@
"export": [ "export": [
"relational_op.json" "relational_op.json"
], ],
"node_id": "c-08dec025530542b695719ef950730a69" "node_id": "c-08dec025530542b695719ef950730a69",
"title": "关系运算符与表达式"
} }
\ No newline at end of file
...@@ -45,5 +45,6 @@ ...@@ -45,5 +45,6 @@
"export": [ "export": [
"logical_op.json" "logical_op.json"
], ],
"node_id": "c-d4ed32eedaed4d44be139eb578ed9f92" "node_id": "c-d4ed32eedaed4d44be139eb578ed9f92",
"title": "逻辑运算符与表达式"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"children": [], "children": [],
"export": [ "export": [
"comma_op.json" "comma_op.json"
] ],
"title": "逗号运算符与表达式"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"export": [ "export": [
"conditional_op.json" "conditional_op.json"
], ],
"node_id": "c-1d3d9e97b98b4151b87c4433d987af83" "node_id": "c-1d3d9e97b98b4151b87c4433d987af83",
"title": "条件运算符"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"sizeof_op.json" "sizeof_op.json"
] ],
"title": "sizeof运算符"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"children": [], "children": [],
"export": [ "export": [
"precedence.json" "precedence.json"
] ],
"title": "运算符优先级与求值顺序"
} }
\ No newline at end of file
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
], ],
"children": [], "children": [],
"export": [], "export": [],
"node_id": "c-5002624ecc8d4be1a3d8eab4579ac7b8" "node_id": "c-5002624ecc8d4be1a3d8eab4579ac7b8",
"title": "运算符与表达式"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"statements_n_blocks.json" "statements_n_blocks.json"
] ],
"title": "语句与程序块"
} }
\ No newline at end of file
...@@ -61,5 +61,6 @@ ...@@ -61,5 +61,6 @@
"ifelse.json", "ifelse.json",
"elseif.json", "elseif.json",
"switch.json" "switch.json"
] ],
"title": "判断语句"
} }
\ No newline at end of file
...@@ -77,5 +77,6 @@ ...@@ -77,5 +77,6 @@
"for.json", "for.json",
"goto.json", "goto.json",
"while.json" "while.json"
] ],
"title": "循环语句"
} }
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "语句与控制流"
} }
\ No newline at end of file
{ {
"node_id": "c-97bc6d47966c47979a9c78cc36741ade", "node_id": "c-97bc6d47966c47979a9c78cc36741ade",
"keywords": [] "keywords": [],
"title": "C语言初阶"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"children": [], "children": [],
"export": [ "export": [
"definition.json" "definition.json"
] ],
"title": "函数的声明与定义"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"parameter_n_argument.json" "parameter_n_argument.json"
] ],
"title": "函数的参数"
} }
\ No newline at end of file
...@@ -10,5 +10,6 @@ ...@@ -10,5 +10,6 @@
"children": [], "children": [],
"export": [ "export": [
"return.json" "return.json"
] ],
"title": "函数的返回"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"function_call.json" "function_call.json"
] ],
"title": "函数的调用"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"recursion.json" "recursion.json"
] ],
"title": "函数的递归"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"global_n_local_var.json" "global_n_local_var.json"
] ],
"title": "局部变量和全局变量"
} }
\ No newline at end of file
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": ["header.json"] "export": [
"header.json"
],
"title": "头文件"
} }
\ No newline at end of file
...@@ -6,5 +6,8 @@ ...@@ -6,5 +6,8 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": ["ex_in_function.json"] "export": [
"ex_in_function.json"
],
"title": "内部函数和外部函数"
} }
\ No newline at end of file
{ {
"node_id": "c-c1d5e45aeba9407a9aba96de5af95e4e", "node_id": "c-c1d5e45aeba9407a9aba96de5af95e4e",
"keywords": [ "keywords": [
"函数", "函数",
"程序结构", "程序结构",
"C语言" "C语言"
] ],
"title": "函数与程序结构"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"array_def.json" "array_def.json"
] ],
"title": "数组简介"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"bubble_sort.json" "bubble_sort.json"
] ],
"title": "一维数组"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"matrix.json" "matrix.json"
] ],
"title": "二维数组"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"vla.json" "vla.json"
] ],
"title": "变长数组"
} }
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "数组"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers.json" "pointers.json"
] ],
"title": "指针与地址"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers_n_func.json" "pointers_n_func.json"
] ],
"title": "指针与函数参数"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers_n_array.json" "pointers_n_array.json"
] ],
"title": "指针与数组"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers_arithmetic_op.json" "pointers_arithmetic_op.json"
] ],
"title": "地址算术运算"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers_array.json" "pointers_array.json"
] ],
"title": "指针数组以及指向指针的指针"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"pointers_2_func.json" "pointers_2_func.json"
] ],
"title": "指向函数的指针"
} }
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "指针"
} }
\ No newline at end of file
...@@ -11,5 +11,6 @@ ...@@ -11,5 +11,6 @@
"export": [ "export": [
"string_io.json" "string_io.json"
], ],
"node_id": "c-bbd1310e647846018a1ff37d29c70ff0" "node_id": "c-bbd1310e647846018a1ff37d29c70ff0",
"title": "字符串输入与输出"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"export": [ "export": [
"string_func.json" "string_func.json"
], ],
"node_id": "c-2aa6707a4e0244dfab606b030f5c35c9" "node_id": "c-2aa6707a4e0244dfab606b030f5c35c9",
"title": "字符串函数"
} }
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "字符串"
} }
\ No newline at end of file
{ {
"node_id": "c-0b3c295f0ba24708845505ee4583303e", "node_id": "c-0b3c295f0ba24708845505ee4583303e",
"keywords": [] "keywords": [],
"title": "C语言中阶"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"structures.json" "structures.json"
] ],
"title": "结构体简介"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"structures_array.json" "structures_array.json"
] ],
"title": "结构体数组"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"structures_pointers.json" "structures_pointers.json"
] ],
"title": "结构体指针"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"structures_n_func.json" "structures_n_func.json"
] ],
"title": "结构体与函数"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"linked_list.json" "linked_list.json"
] ],
"title": "链式结构"
} }
\ No newline at end of file
{ {
"node_id": "c-457fbccd00ef4ce3b0f44702f9755b43", "node_id": "c-457fbccd00ef4ce3b0f44702f9755b43",
"keywords": [ "keywords": [
"结构体", "结构体",
"C语言" "C语言"
] ],
"title": "结构体"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"unions.json" "unions.json"
] ],
"title": "联合体"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"enum.json" "enum.json"
] ],
"title": "枚举类型"
} }
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "联合体与枚举类型"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"check.json" "check.json"
] ],
"title": "位和字节"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"count.json" "count.json"
] ],
"title": "二进制"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"oct.json" "oct.json"
] ],
"title": "八进制"
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
], ],
"children": [], "children": [],
"export": [ "export": [
"bin_to_hex.json" "bin_to_hex.json"
] ],
"title": "十六进制"
} }
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
], ],
"children": [], "children": [],
"export": [ "export": [
"bit_op.json" "bit_op.json"
] ],
"title": "位逻辑运算符"
} }
\ No newline at end of file
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
], ],
"children": [], "children": [],
"export": [ "export": [
"pack01.json", "pack01.json",
"pack02.json" "pack02.json"
] ],
"title": "对齐特性"
} }
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
], ],
"children": [], "children": [],
"export": [ "export": [
"bit_field.json" "bit_field.json"
] ],
"title": "位字段"
} }
\ No newline at end of file
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "位运算"
} }
\ No newline at end of file
...@@ -10,5 +10,6 @@ ...@@ -10,5 +10,6 @@
"define_func_1.json", "define_func_1.json",
"define_func_2.json", "define_func_2.json",
"define_func_3.json" "define_func_3.json"
] ],
"title": "宏定义"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"export": [ "export": [
"calc.json", "calc.json",
"calc_test.json" "calc_test.json"
] ],
"title": "#include指令"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"undef.json" "undef.json"
] ],
"title": "#undef指令"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"export": [ "export": [
"ifdef01.json", "ifdef01.json",
"ifdef02.json" "ifdef02.json"
] ],
"title": "条件编译"
} }
\ No newline at end of file
...@@ -7,5 +7,6 @@ ...@@ -7,5 +7,6 @@
"children": [], "children": [],
"export": [ "export": [
"inline01.json" "inline01.json"
] ],
"title": "内联函数"
} }
\ No newline at end of file
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "预处理器"
} }
\ No newline at end of file
...@@ -39,5 +39,6 @@ ...@@ -39,5 +39,6 @@
} }
} }
], ],
"export": [] "export": [],
"title": "文件的基本操作"
} }
\ No newline at end of file
...@@ -8,5 +8,6 @@ ...@@ -8,5 +8,6 @@
"children": [], "children": [],
"export": [ "export": [
"file_hash.json" "file_hash.json"
] ],
"title": "文件的读写"
} }
\ No newline at end of file
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "文件"
} }
\ No newline at end of file
...@@ -5,5 +5,8 @@ ...@@ -5,5 +5,8 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": ["storage_categories.json"] "export": [
"storage_categories.json"
],
"title": "存储类别"
} }
\ No newline at end of file
{ {
"node_id": "c-e75bdc3470954cb38bdfcf4f0ed3680b", "node_id": "c-e75bdc3470954cb38bdfcf4f0ed3680b",
"keywords": [ "keywords": [
"存储管理", "存储管理",
"内存管理", "内存管理",
"内存动态管理", "内存动态管理",
"C语言" "C语言"
], ],
"children": [ "children": [
{ {
"内存分配:malloc()": { "内存分配:malloc()": {
"keywords": [ "keywords": [
"内存分配", "内存分配",
"malloc", "malloc",
"C语言" "C语言"
], ],
"children": [], "children": [],
"node_id": "c-cc8211e14d6f46c8b91b27f4b5ae2c3a" "node_id": "c-cc8211e14d6f46c8b91b27f4b5ae2c3a"
} }
}, },
{ {
"内存释放:free()": { "内存释放:free()": {
"keywords": [ "keywords": [
"内存释放", "内存释放",
"free", "free",
"C语言" "C语言"
], ],
"children": [], "children": [],
"node_id": "c-3ef9cac7dde7450cba53d20005fefe77" "node_id": "c-3ef9cac7dde7450cba53d20005fefe77"
} }
} }
], ],
"export": [ "export": [
"memory_management.json" "memory_management.json"
] ],
"title": "内存动态管理"
} }
\ No newline at end of file
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "存储管理"
} }
\ No newline at end of file
{ {
"node_id": "c-77363abd916c4981b595f44138f53e0a", "node_id": "c-77363abd916c4981b595f44138f53e0a",
"keywords": [ "keywords": [
"数学库", "数学库",
"math.h", "math.h",
"标准库", "标准库",
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [ "export": [
"math.json" "math.json"
] ],
"title": "数学库"
} }
\ No newline at end of file
...@@ -7,5 +7,8 @@ ...@@ -7,5 +7,8 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": ["qsort.json"] "export": [
"qsort.json"
],
"title": "通用工具库"
} }
\ No newline at end of file
...@@ -9,5 +9,6 @@ ...@@ -9,5 +9,6 @@
"children": [], "children": [],
"export": [ "export": [
"assert.json" "assert.json"
] ],
"title": "断言库"
} }
\ No newline at end of file
...@@ -6,5 +6,6 @@ ...@@ -6,5 +6,6 @@
"C语言" "C语言"
], ],
"children": [], "children": [],
"export": [] "export": [],
"title": "标准函数库"
} }
\ No newline at end of file
{ {
"node_id": "c-29426c5de15a472ba147b32bd24b73a5", "node_id": "c-29426c5de15a472ba147b32bd24b73a5",
"keywords": [] "keywords": [],
"title": "C语言高阶"
} }
\ No newline at end of file
{ {
"tree_name": "C", "tree_name": "C",
"keywords": [], "keywords": [],
"node_id": "c-569d5e11c4fc5de7844053d9a733c5e8" "node_id": "c-569d5e11c4fc5de7844053d9a733c5e8",
"title": "C"
} }
\ No newline at end of file
...@@ -68,6 +68,7 @@ def gen_tree(data_path): ...@@ -68,6 +68,7 @@ def gen_tree(data_path):
def ensure_id_helper(node): def ensure_id_helper(node):
flag = False flag = False
if (node.get('node_id') is None) or node.get('node_id') in id_set: if (node.get('node_id') is None) or node.get('node_id') in id_set:
node['node_id'] = gen_node_id() node['node_id'] = gen_node_id()
flag = True flag = True
...@@ -83,6 +84,25 @@ def gen_tree(data_path): ...@@ -83,6 +84,25 @@ def gen_tree(data_path):
def ensure_node_id(cfg): def ensure_node_id(cfg):
return ensure_id_helper(cfg) return ensure_id_helper(cfg)
def ensure_title_helper(node, cfg_path, title=""):
flag = False
if node.get('title') is None:
if cfg_path:
node['title'] = re.sub("^[0-9]{1,3}\.", "", os.path.split(os.path.dirname(cfg_path))[-1])
else:
node['title'] = title
flag = True
if 'children' in node:
for c in node["children"]:
flag = flag or ensure_title_helper(list(c.values())[0], None, list(c.keys())[0])
return flag
def ensure_title(cfg, cfg_path):
return ensure_title_helper(cfg, cfg_path)
def make_node(name, node_id, keywords, children=None): def make_node(name, node_id, keywords, children=None):
node = {} node = {}
node_children = children or [] node_children = children or []
...@@ -98,6 +118,10 @@ def gen_tree(data_path): ...@@ -98,6 +118,10 @@ def gen_tree(data_path):
cfg = load_json(cfg_path) cfg = load_json(cfg_path)
if ensure_node_id(cfg): if ensure_node_id(cfg):
dump_json(cfg_path, cfg) dump_json(cfg_path, cfg)
if ensure_title(cfg, cfg_path):
cfg["title"] = "C"
dump_json(cfg_path, cfg, exist_ok=True, override=True)
tree_node = { tree_node = {
"node_id": cfg['node_id'], "node_id": cfg['node_id'],
"keywords": cfg['keywords'], "keywords": cfg['keywords'],
...@@ -113,6 +137,8 @@ def gen_tree(data_path): ...@@ -113,6 +137,8 @@ def gen_tree(data_path):
level_cfg = load_json(level_path) level_cfg = load_json(level_path)
if ensure_node_id(level_cfg) or check_export(level_no_dir, level_cfg): if ensure_node_id(level_cfg) or check_export(level_no_dir, level_cfg):
dump_json(level_path, level_cfg, exist_ok=True, override=True) dump_json(level_path, level_cfg, exist_ok=True, override=True)
if ensure_title(level_cfg, level_path):
dump_json(level_path, level_cfg, exist_ok=True, override=True)
level_node, level_node_children = make_node( level_node, level_node_children = make_node(
level_name, level_cfg['node_id'], level_cfg['keywords']) level_name, level_cfg['node_id'], level_cfg['keywords'])
...@@ -125,6 +151,8 @@ def gen_tree(data_path): ...@@ -125,6 +151,8 @@ def gen_tree(data_path):
chapter_cfg = load_json(chapter_path) chapter_cfg = load_json(chapter_path)
if ensure_node_id(chapter_cfg) or check_export(chapter_no_dir, chapter_cfg): if ensure_node_id(chapter_cfg) or check_export(chapter_no_dir, chapter_cfg):
dump_json(chapter_path, chapter_cfg, exist_ok=True, override=True) dump_json(chapter_path, chapter_cfg, exist_ok=True, override=True)
if ensure_title(chapter_cfg, chapter_path):
dump_json(chapter_path, chapter_cfg, exist_ok=True, override=True)
chapter_node, chapter_node_children = make_node( chapter_node, chapter_node_children = make_node(
chapter_name, chapter_cfg['node_id'], chapter_cfg['keywords']) chapter_name, chapter_cfg['node_id'], chapter_cfg['keywords'])
...@@ -156,6 +184,9 @@ def gen_tree(data_path): ...@@ -156,6 +184,9 @@ def gen_tree(data_path):
if flag: if flag:
dump_json(sec_path, sec_cfg, exist_ok=True, override=True) dump_json(sec_path, sec_cfg, exist_ok=True, override=True)
if ensure_title(sec_cfg, sec_path):
dump_json(sec_path, sec_cfg, exist_ok=True, override=True)
# 保存技能树骨架 # 保存技能树骨架
tree_path = os.path.join(data_path, 'tree.json') tree_path = os.path.join(data_path, 'tree.json')
dump_json(tree_path, root, exist_ok=True, override=True) dump_json(tree_path, root, exist_ok=True, override=True)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册