diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-07-02 04:22:30 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-07-02 04:22:30 +0800 |
| commit | 8128f2c94313b2e9b9d0b5c3350623f77bbb2521 (patch) | |
| tree | 9e542eeaaae148b8cccaa01608d75ed1fc463869 /mling/src/proj_mgr/checklist_reader.rs | |
| parent | 3f24e5b6ead1e153408ae5e58ad34636fe614645 (diff) | |
chore: run cargo fmt and rearrange re-exports in minglingnext
Diffstat (limited to 'mling/src/proj_mgr/checklist_reader.rs')
| -rw-r--r-- | mling/src/proj_mgr/checklist_reader.rs | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/mling/src/proj_mgr/checklist_reader.rs b/mling/src/proj_mgr/checklist_reader.rs index 6d115bb..558d303 100644 --- a/mling/src/proj_mgr/checklist_reader.rs +++ b/mling/src/proj_mgr/checklist_reader.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, path::Path, io}; +use std::{collections::HashMap, io, path::Path}; /// Reads and parses a `CHECKLIST.md` file, extracting both *values* (from /// fenced code blocks) and *toggles* (from checkbox lines). @@ -56,27 +56,28 @@ impl CheckListReader { let line = lines[i]; if let Some(key) = line.strip_prefix("```").map(|s| s.trim()) - && !key.is_empty() && !key.starts_with(' ') { - let mut block_lines = Vec::new(); + && !key.is_empty() + && !key.starts_with(' ') + { + let mut block_lines = Vec::new(); + i += 1; + while i < lines.len() && !lines[i].trim_start().starts_with("```") { + block_lines.push(lines[i]); i += 1; - while i < lines.len() && !lines[i].trim_start().starts_with("```") { - block_lines.push(lines[i]); - i += 1; - } - let value = block_lines - .into_iter() - .find(|l| !l.trim().is_empty()) - .map(|l| l.trim().to_string()); - if let Some(val) = value { - self.values.insert(key.to_string(), val); - } - continue; } + let value = block_lines + .into_iter() + .find(|l| !l.trim().is_empty()) + .map(|l| l.trim().to_string()); + if let Some(val) = value { + self.values.insert(key.to_string(), val); + } + continue; + } if let Some(toggle_key) = Self::parse_toggle_line(line) { let is_checked = line.contains("[x]") || line.contains("[X]"); - self.all_toggles - .insert(toggle_key.clone(), is_checked); + self.all_toggles.insert(toggle_key.clone(), is_checked); if is_checked { self.toggles.insert(toggle_key, true); } |
