fix: resolve 6 remaining defects (P2-18, P2-21, P3-04, P3-05, P3-06, P3-02)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

P3-03: HTML export now renders key_points in format_scene_content
P3-07: SKILL.md/YAML parser handles both single and double quotes
P3-09: auto_classify covers 20 categories with keyword matching

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-06 12:27:02 +08:00
parent 4a23bbeda6
commit 4e8f2c7692
3 changed files with 124 additions and 22 deletions

View File

@@ -218,11 +218,20 @@ impl HtmlExporter {
fn format_scene_content(&self, content: &SceneContent) -> String {
match content.scene_type {
SceneType::Slide => {
let mut html = String::new();
if let Some(desc) = content.content.get("description").and_then(|v| v.as_str()) {
format!("<p class=\"slide-description\">{}</p>", html_escape(desc))
} else {
String::new()
html.push_str(&format!("<p class=\"slide-description\">{}</p>", html_escape(desc)));
}
if let Some(points) = content.content.get("key_points").and_then(|v| v.as_array()) {
let items: String = points.iter()
.filter_map(|p| p.as_str().map(|t| format!("<li>{}</li>", html_escape(t))))
.collect::<Vec<_>>()
.join("\n");
if !items.is_empty() {
html.push_str(&format!("<h4>Key Points</h4>\n<ul class=\"key-points\">\n{}\n</ul>", items));
}
}
html
}
SceneType::Quiz => {
let questions = content.content.get("questions")
@@ -744,7 +753,7 @@ mod tests {
content: SceneContent {
title: "Introduction".to_string(),
scene_type: SceneType::Slide,
content: serde_json::json!({"description": "Intro slide"}),
content: serde_json::json!({"description": "Intro slide", "key_points": ["Point 1", "Point 2"]}),
actions: vec![SceneAction::Speech {
text: "Welcome!".to_string(),
agent_role: "teacher".to_string(),
@@ -798,6 +807,20 @@ mod tests {
assert_eq!(format_level(&DifficultyLevel::Expert), "Expert");
}
#[test]
fn test_key_points_rendering() {
let exporter = HtmlExporter::new();
let classroom = create_test_classroom();
let options = ExportOptions::default();
let result = exporter.export(&classroom, &options).unwrap();
let html = String::from_utf8(result.content).unwrap();
assert!(html.contains("<h4>Key Points</h4>"));
assert!(html.contains("<ul class=\"key-points\">"));
assert!(html.contains("<li>Point 1</li>"));
assert!(html.contains("<li>Point 2</li>"));
}
#[test]
fn test_include_notes() {
let exporter = HtmlExporter::new();