Allow specifying redirects as path start and end

This commit is contained in:
Joscha 2022-10-22 19:30:44 +02:00
parent 0e3d61d632
commit e91a2db1b1
2 changed files with 26 additions and 3 deletions

View file

@ -214,6 +214,19 @@ impl AdjacencyList<PageInfo, LinkInfo> {
panic!("Invalid link detected!");
}
}
// Check that all redirect pages have exactly one link
for page_idx in 0..self.pages.len() as u32 - 1 {
let page = self.page(page_idx);
if page.data.redirect {
let start_idx = page.link_idx;
let end_idx = self.page(page_idx + 1).link_idx;
let n_links = end_idx - start_idx;
if n_links != 1 {
panic!("Redirect {:?} has {n_links} links", page.data.title);
}
}
}
}
}