vpm: fix get_all_modules() (#14097)

Isaiah 2022-04-20 05:15:30 -04:00 committed by Jef Roosens
parent 9c7da323f1
commit ae3906141d
Signed by: Jef Roosens
GPG Key ID: B75D4F293C7052DB
1 changed files with 8 additions and 3 deletions

View File

@ -584,17 +584,22 @@ fn get_all_modules() []string {
mut read_len := 0 mut read_len := 0
mut modules := []string{} mut modules := []string{}
for read_len < s.len { for read_len < s.len {
mut start_token := '<a href="/mod' mut start_token := "<a href='/mod"
end_token := '</a>' end_token := '</a>'
// get the start index of the module entry // get the start index of the module entry
mut start_index := s.index_after(start_token, read_len) mut start_index := s.index_after(start_token, read_len)
if start_index == -1 {
start_token = '<a href="/mod'
start_index = s.index_after(start_token, read_len)
if start_index == -1 { if start_index == -1 {
break break
} }
}
// get the index of the end of anchor (a) opening tag // get the index of the end of anchor (a) opening tag
// we use the previous start_index to make sure we are getting a module and not just a random 'a' tag // we use the previous start_index to make sure we are getting a module and not just a random 'a' tag
start_token = '">' start_token = '>'
start_index = s.index_after(start_token, start_index) + start_token.len start_index = s.index_after(start_token, start_index) + start_token.len
// get the index of the end of module entry // get the index of the end of module entry
end_index := s.index_after(end_token, start_index) end_index := s.index_after(end_token, start_index)
if end_index == -1 { if end_index == -1 {