From 5a84a6c1241390bce87366633467a5c46d960fec Mon Sep 17 00:00:00 2001 From: Nelson Chen Date: Sat, 8 Jul 2023 09:14:32 -0700 Subject: [PATCH] Prepend wiki if homepage and if the href doesn't start with wiki --- src/scraper.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scraper.rs b/src/scraper.rs index ee41a37..087ef65 100644 --- a/src/scraper.rs +++ b/src/scraper.rs @@ -40,8 +40,8 @@ pub fn process_html( let new_string_href = "/m".to_owned() + &string_href; thing.set_attr("href", &new_string_href); } else { - // Prepend wiki if homepage - if homepage_prepend { + // Prepend wiki if homepage and if the href doesn't start with wiki + if homepage_prepend && !string_href.starts_with("wiki/") { let new_string_href = "wiki/".to_owned() + &string_href; thing.set_attr("href", &new_string_href); }