From dc985df5fe8c748e05181a8f5062eba3f9a2b64a Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Fri, 6 Feb 2026 14:51:33 +1300 Subject: Add comments More housekeeping to make the codebase more understandable. --- src/main.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 14a1f79..33fe16d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -166,6 +166,7 @@ pub fn write_file(text: &str, destination: &PathBuf, ext: &str, last_modified: O } } +// Turn a string into a tidy URL slug. pub fn make_url_safe(text: &str) -> String { text.to_ascii_lowercase().chars().filter_map(|c| if c.is_alphanumeric() || "-_~.+/#".contains(c) { Some(c) } @@ -174,6 +175,7 @@ pub fn make_url_safe(text: &str) -> String { .collect() } +// Prevent link hrefs from breaking out of quotations. pub fn url_encode(text: &str) -> String { let mut output = String::new(); for c in text.chars() { -- cgit v1.2.3-70-g09d2