fix(cph): correct nested outline hierarchy

This commit is contained in:
2026-08-05 17:36:43 +08:00
committed by 洪佳荣
parent dd8fcfd366
commit 3d46525f40
10 changed files with 39 additions and 1078 deletions
+19 -1
View File
@@ -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.