aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-06-29 12:01:13 +0000
committerFuwn <[email protected]>2024-06-29 12:01:13 +0000
commit45025ee07d09996052eee941ba5f2fa13d2fa023 (patch)
tree72f2862da5547c296e363e5d07b6b8c2116f2ac0 /src
parentformat(readme): reformat (diff)
downloadseptember-45025ee07d09996052eee941ba5f2fa13d2fa023.tar.xz
september-45025ee07d09996052eee941ba5f2fa13d2fa023.zip
fix(html): empty alt text behaviour
Diffstat (limited to 'src')
-rw-r--r--src/html.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/html.rs b/src/html.rs
index 1e85685..cf905f8 100644
--- a/src/html.rs
+++ b/src/html.rs
@@ -4,7 +4,13 @@ fn link_from_host_href(url: &Url, href: &str) -> Option<String> {
Some(format!(
"gemini://{}{}{}",
url.domain()?,
- { if href.starts_with('/') { "" } else { "/" } },
+ {
+ if href.starts_with('/') {
+ ""
+ } else {
+ "/"
+ }
+ },
href
))
}
@@ -153,14 +159,14 @@ pub fn from_gemini(
html.push_str(&format!(
"<p><a href=\"{}\">{}</a> <i>Embedded below</i></p>\n",
href,
- safe(&text.clone().unwrap_or_default()),
+ safe(&text.clone().unwrap_or_else(|| to.clone())),
));
}
html.push_str(&format!(
"<p><img src=\"{}\" alt=\"{}\" /></p>\n",
safe(&href),
- safe(&text.clone().unwrap_or_default())
+ safe(&text.clone().unwrap_or_else(|| to.clone())),
));
continue;
@@ -173,7 +179,7 @@ pub fn from_gemini(
html.push_str(&format!(
"<a href=\"{}\">{}</a>",
href,
- safe(&text.clone().unwrap_or_default()),
+ safe(&text.clone().unwrap_or_else(|| to.clone())),
));
}
Node::Heading { level, text } => {