From 850e65b5df03865640eb4d36f4db7c0c18e61981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 25 Jul 2021 17:31:18 +0200 Subject: [PATCH] fix link detection --- src/main.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 688db17..430a203 100644 --- a/src/main.rs +++ b/src/main.rs @@ -237,17 +237,24 @@ async fn render( let mut nodes: Vec> = vec![]; let mut links: Vec> = vec![]; - let page_ids: Vec<&String> = cache.pages.keys().collect(); + let page_ids: Vec = cache.pages.keys().map(|n| normalize_name(n)).collect(); &cache.pages.iter().for_each(|(path, page)| { - nodes.push([("id".to_string(), path.clone())].iter().cloned().collect()); + let normalized_path = normalize_name(path); + nodes.push( + [("id".to_string(), normalized_path.clone())] + .iter() + .cloned() + .collect(), + ); page.links .iter() + .map(|l| normalize_name(l)) .filter(|link| page_ids.contains(link)) .for_each(|link| { links.push( [ - ("source".to_string(), path.clone()), + ("source".to_string(), normalized_path.clone()), ("target".to_string(), link.clone()), ] .iter()