Compare commits

..

No commits in common. "b320605f268651b410099bd836882d974767e821" and "9ebc0c9736dc4de5fb0a311f72fd7be7b675a778" have entirely different histories.

5 changed files with 15 additions and 26 deletions

View file

@ -346,7 +346,6 @@ fn main_debug_rss(cli: CliDebugRss) -> Result<()> {
println!("{}", item.channel_title); println!("{}", item.channel_title);
println!("{}", item.inner.title.as_ref().unwrap()); println!("{}", item.inner.title.as_ref().unwrap());
println!("{}", item.date.to_rfc3339()); println!("{}", item.date.to_rfc3339());
println!("{}", item.inner.link.as_ref().unwrap());
println!(); println!();
} }

View file

@ -58,14 +58,6 @@ impl Config {
} }
} }
fn day_link(date: chrono::NaiveDate) -> maud::PreEscaped<String> {
let date_s = date.format("%-d %A");
let id = date.format("%F");
maud::html! {
h3 id=(id) { (date_s) " " a href=(format!("#{id}")) title=(format!("Permalink to {date_s}")) {"🔗"} }
}
}
fn calendar_link(calendar_ui: &crate::CalendarUi) -> maud::PreEscaped<String> { fn calendar_link(calendar_ui: &crate::CalendarUi) -> maud::PreEscaped<String> {
if let Some(html_url) = &calendar_ui.html_url { if let Some(html_url) = &calendar_ui.html_url {
maud::html! { a href=(html_url) { (calendar_ui.short_name) } } maud::html! { a href=(html_url) { (calendar_ui.short_name) } }
@ -118,7 +110,7 @@ fn calendars_page(upstreams: &[crate::CalendarUi], now: DateTime<chrono_tz::Tz>)
.into_string() .into_string()
} }
pub(crate) fn feed_page(_feed_items: &[crate::FeedItem], _now: DateTime<chrono_tz::Tz>) -> String { pub(crate) fn feed_page(feed_items: &[crate::FeedItem], now: DateTime<chrono_tz::Tz>) -> String {
todo!() todo!()
} }
@ -170,8 +162,10 @@ fn index_page(
p class="past"{ s { (date.format("%-d %A")) } } p class="past"{ s { (date.format("%-d %A")) } }
}); });
} else { } else {
let date_s = date.format("%-d %A");
let id = date.format("%F");
html_list.push(maud::html! { html_list.push(maud::html! {
(day_link(date)) h3 id=(id) { (date_s) " " a href=(format!("#{id}")) title=(format!("Permalink to {date_s}")) {"🔗"} }
hr{} hr{}
}); });
} }

View file

@ -27,8 +27,7 @@ struct Event {
_end_time: Option<String>, _end_time: Option<String>,
#[serde(alias = "eventName")] #[serde(alias = "eventName")]
event_name: String, event_name: String,
// Seen in test data where this can be missing location: String,
location: Option<String>,
#[serde(alias = "Id")] #[serde(alias = "Id")]
id: String, id: String,
#[serde(alias = "startDate")] #[serde(alias = "startDate")]
@ -96,7 +95,7 @@ impl Calendar {
Some(Ok(EventInstance { Some(Ok(EventInstance {
calendar_ui: self.config.ui.clone(), calendar_ui: self.config.ui.clone(),
dtstart, dtstart,
location: ev.location.clone(), location: Some(ev.location.clone()),
recurrence_id: None, recurrence_id: None,
summary: Some(ev.event_name.clone()), summary: Some(ev.event_name.clone()),
uid: Some(ev.id.clone()), uid: Some(ev.id.clone()),
@ -112,10 +111,9 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = config.dl.file_path.clone(); let path = &config.dl.file_path;
let s = let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?;
std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?; Self::read_from_str(config, &s)
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }

View file

@ -95,10 +95,9 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = config.dl.file_path.clone(); let path = &config.dl.file_path;
let s = let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?;
std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?; Self::read_from_str(config, &s)
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }

View file

@ -267,9 +267,8 @@ impl Calendar {
} }
pub(crate) fn read_from_config(config: Config) -> Result<Self> { pub(crate) fn read_from_config(config: Config) -> Result<Self> {
let path = config.dl.file_path.clone(); let path = &config.dl.file_path;
let s = let s = std::fs::read_to_string(path).with_context(|| format!("Couldn't read {path:?}"))?;
std::fs::read_to_string(&path).with_context(|| format!("Couldn't read {path:?}"))?; Self::read_from_str(config, &s)
Self::read_from_str(config, &s).with_context(|| format!("Couldn't parse {path:?}"))
} }
} }