removed get_parents func

This commit is contained in:
bjt-user 2024-05-06 01:32:35 +02:00
parent 170ed10a17
commit c92fde4988

18
main.go
View File

@ -33,22 +33,6 @@ func get_heading_level(heading_text string) int {
return level return level
} }
func get_parents(headings []heading) {
for index, _ := range headings {
if index == 0 {
headings[index].parent = nil
continue
}
for i := (index - 1); i >= 0; i-- {
if headings[i].level < headings[index].level {
headings[index].parent = &headings[i]
break
}
}
}
}
func parse_file(file_name string) []heading { func parse_file(file_name string) []heading {
file_content_raw, err := os.ReadFile(file_name) file_content_raw, err := os.ReadFile(file_name)
@ -76,8 +60,6 @@ func main() {
headings = parse_file(file_name) headings = parse_file(file_name)
get_parents(headings)
fmt.Println(path.Base(file_name)) fmt.Println(path.Base(file_name))
tree(-1, "", headings) tree(-1, "", headings)
} }