vpm: fix get_all_modules() (#14097)
parent
9c7da323f1
commit
ae3906141d
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue