summaryrefslogtreecommitdiff
path: root/src/generate_html.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/generate_html.rs')
-rw-r--r--src/generate_html.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/generate_html.rs b/src/generate_html.rs
index d6624b8..3486352 100644
--- a/src/generate_html.rs
+++ b/src/generate_html.rs
@@ -281,9 +281,18 @@ fn line_to_html(line: &Line, page: &Page, website: &Website) -> String {
let mut label = label.to_string();
// Strip the protocol from the path when using the path as a label.
if label.is_empty() {
+ label = path.to_string();
for protocol in ["mailto://", "http://", "https://"] {
if let Some(stripped) = path.strip_prefix(protocol) {
- label = stripped.to_string(); } } }
+ label = stripped.to_string();
+ }
+ }
+ }
+ // Support absolute local paths.
+ let path = match path.strip_prefix('/') {
+ Some(stripped) => format!("{}{stripped}", page.root()),
+ None => path.to_string(),
+ };
let label = sanitize_text(&label);
html.push_str(&format!("<a href='{path}' class='external'>{label}</a>"));
}