forked from EduCraft/curriculum-project-hub
fix(cph): correct nested outline hierarchy
This commit is contained in:
@@ -12,5 +12,10 @@ path = "segments/开场白"
|
||||
[[children]]
|
||||
kind = "section"
|
||||
path = "导言簇"
|
||||
notes = "这里先建立直观图像,再进入分组推导。"
|
||||
|
||||
[[children]]
|
||||
kind = "section"
|
||||
path = "收束簇"
|
||||
|
||||
[targets.student]
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
[group]
|
||||
title = "收束簇"
|
||||
|
||||
[[children]]
|
||||
kind = "segment"
|
||||
path = "segments/总结"
|
||||
@@ -0,0 +1 @@
|
||||
kind = "segment"
|
||||
@@ -0,0 +1 @@
|
||||
总结
|
||||
@@ -121,6 +121,7 @@ fn nested_sections_flatten_depth_first_with_correct_depths() {
|
||||
PathBuf::from("导言簇/segments/子段一"),
|
||||
PathBuf::from("导言簇/嵌套子节/lemmas/子引理"),
|
||||
PathBuf::from("导言簇/segments/子段二"),
|
||||
PathBuf::from("收束簇/segments/总结"),
|
||||
],
|
||||
"root-relative paths must accumulate through every nesting level"
|
||||
);
|
||||
@@ -139,7 +140,7 @@ fn nested_sections_flatten_depth_first_with_correct_depths() {
|
||||
kind: "section".to_string(),
|
||||
title: "导言簇".to_string(),
|
||||
depth: 1,
|
||||
notes: None,
|
||||
notes: Some("这里先建立直观图像,再进入分组推导。".to_string()),
|
||||
path: PathBuf::from("导言簇"),
|
||||
},
|
||||
OutlineEntry::Element {
|
||||
@@ -161,8 +162,25 @@ fn nested_sections_flatten_depth_first_with_correct_depths() {
|
||||
part_index: 3,
|
||||
depth: 1,
|
||||
}, // 导言簇/segments/子段二
|
||||
OutlineEntry::Section {
|
||||
kind: "section".to_string(),
|
||||
title: "收束簇".to_string(),
|
||||
depth: 1,
|
||||
notes: None,
|
||||
path: PathBuf::from("收束簇"),
|
||||
},
|
||||
OutlineEntry::Element {
|
||||
part_index: 4,
|
||||
depth: 1,
|
||||
}, // 收束簇/segments/总结
|
||||
]
|
||||
);
|
||||
let document = lesson.outline_document();
|
||||
assert_eq!(document.children.len(), 3);
|
||||
assert_eq!(document.children[1].title, "导言簇");
|
||||
assert_eq!(document.children[1].children.len(), 3);
|
||||
assert_eq!(document.children[2].title, "收束簇");
|
||||
assert_eq!(document.children[2].children[0].title, "总结");
|
||||
|
||||
// The outer section declares [group].title = "导言簇"; the inner section
|
||||
// has no [group] at all, so its title falls back to the folder basename.
|
||||
|
||||
Reference in New Issue
Block a user