1
0
Fork 0
mirror of https://github.com/archtechx/todo-system.git synced 2025-12-12 09:04:03 +00:00

support indented nested list items in .md files

This commit is contained in:
Samuel Štancl 2023-11-23 17:08:47 +01:00
parent 887199995a
commit a346a61c7c
3 changed files with 9 additions and 9 deletions

View file

@ -11,12 +11,12 @@ abc
def def
- foo - foo
- baz - baz
- [ ] baz - [ ] baz
## TODOs ## TODOs
- abc - abc
- todo0 def - todo0 def
- [ ] bar - [ ] bar
- [ ] baz - [ ] baz

View file

@ -4,8 +4,8 @@
## High priority ## High priority
- todo0 a - todo0 a
- foo - foo
- [ ] bar - [ ] bar
## Responsivity ## Responsivity
- abc - abc

View file

@ -161,7 +161,7 @@ pub fn scan_todo_file(path: &Path, entries: &mut Vec<Entry>) -> io::Result<()> {
continue; continue;
} }
if ! line.starts_with('-') { if ! line.trim_start().starts_with('-') {
continue; continue;
} }
@ -182,7 +182,7 @@ pub fn scan_todo_file(path: &Path, entries: &mut Vec<Entry>) -> io::Result<()> {
} }
} }
let text = line.trim_start_matches("- [ ] ").trim_start_matches("- ").to_string(); let text = line.trim_start().trim_start_matches("- [ ] ").trim_start_matches("- ").to_string();
if let Some(category) = current_category { if let Some(category) = current_category {
entries.push(Entry { entries.push(Entry {
@ -234,7 +234,7 @@ pub fn scan_readme_file(path: &Path, entries: &mut Vec<Entry>) -> io::Result<()>
continue; continue;
} }
if ! line.starts_with('-') { if ! line.trim_start().starts_with('-') {
continue; continue;
} }
@ -257,7 +257,7 @@ pub fn scan_readme_file(path: &Path, entries: &mut Vec<Entry>) -> io::Result<()>
// README.md can only have priority entries and generic entries // README.md can only have priority entries and generic entries
entries.push(Entry { entries.push(Entry {
text: line.trim_start_matches("- [ ] ").trim_start_matches("- ").to_string(), text: line.trim_start().trim_start_matches("- [ ] ").trim_start_matches("- ").to_string(),
location: Location { location: Location {
file: path.to_path_buf(), file: path.to_path_buf(),
line: line_num + 1, line: line_num + 1,