From 2b01ce151272edc85ff975c72780532f35d3b3f1 Mon Sep 17 00:00:00 2001 From: Vika Date: Sat, 7 Sep 2024 16:49:23 +0300 Subject: If like/bookmark-of name is empty, pretend it isn't there --- templates/src/mf2.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'templates/src') diff --git a/templates/src/mf2.rs b/templates/src/mf2.rs index 550adfc..643db15 100644 --- a/templates/src/mf2.rs +++ b/templates/src/mf2.rs @@ -60,6 +60,7 @@ markup::define! { a."u-like-of"[href=likeof["properties"]["url"][0].as_str().unwrap()] { @likeof["properties"]["name"][0] .as_str() + .and_then(|s| if s.trim().is_empty() { None } else { Some(s) }) .unwrap_or_else(|| likeof["properties"]["url"][0].as_str().unwrap()) } } @@ -77,6 +78,7 @@ markup::define! { a."u-bookmark-of"[href=bookmarkof["properties"]["url"][0].as_str().unwrap()] { @bookmarkof["properties"]["name"][0] .as_str() + .and_then(|s| if s.trim().is_empty() { None } else { Some(s) }) .unwrap_or_else(|| bookmarkof["properties"]["url"][0].as_str().unwrap()) } } -- cgit 1.4.1