From 5b30cc178a5f890a9b5b1930a7062e8b05544f49 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Thu, 3 Aug 2017 21:13:27 +0200 Subject: [PATCH 1/2] Detect relative urls in tidy check --- src/tools/tidy/src/style.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index b42beb37821..d0483e64b40 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -79,11 +79,11 @@ fn line_is_url(line: &str) -> bool { => state = EXP_URL, (EXP_LINK_LABEL_OR_URL, w) - if w.starts_with("http://") || w.starts_with("https://") + if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") => state = EXP_END, (EXP_URL, w) - if w.starts_with("http://") || w.starts_with("https://") + if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") => state = EXP_END, (_, _) => return false, From 608863d81770c804f6e527ec16b2cc843ee0c050 Mon Sep 17 00:00:00 2001 From: Ruud van Asseldonk Date: Fri, 4 Aug 2017 13:24:00 +0200 Subject: [PATCH 2/2] Only allow long relative urls after a link label Yellow is indeed a nice color for a bikeshed. --- src/tools/tidy/src/style.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index d0483e64b40..a689d8a8be4 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -79,7 +79,7 @@ fn line_is_url(line: &str) -> bool { => state = EXP_URL, (EXP_LINK_LABEL_OR_URL, w) - if w.starts_with("http://") || w.starts_with("https://") || w.starts_with("../") + if w.starts_with("http://") || w.starts_with("https://") => state = EXP_END, (EXP_URL, w)