From b1e3218eb315a41a939ee40eb17adaa6455ad223 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Sat, 18 Nov 2023 10:12:30 +0100 Subject: [PATCH] say when there is no text in a footprint --- src/feeds/mod.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/feeds/mod.rs b/src/feeds/mod.rs index 9c20599..d58f0f6 100644 --- a/src/feeds/mod.rs +++ b/src/feeds/mod.rs @@ -42,10 +42,17 @@ const ISO8601_DATE: u128 = iso8601::Config::DEFAULT impl Footprint { pub fn into_rss_item(self, root_url: &str) -> Item { + let text = if String::is_empty(&self.text) { + "No description" + } else { + &self.text + }; + // injection, I know let desc = format!( - "{}

---

from {}", - self.text, - page_url(root_url, self.page) + "{}

---

from page {}", + text, + page_url(root_url, self.page), + self.page ); ItemBuilder::default() .title(Some(self.title))