diff --git a/src/main.rs b/src/main.rs index e0d9a52..e24df58 100644 --- a/src/main.rs +++ b/src/main.rs @@ -34,6 +34,9 @@ struct ConfigOutput { /// Used as the OpenGraph description in meta tags description: String, + /// Hide all these UIDs from the final output + hide_uids: BTreeSet, + /// Timezone to use for output (e.g. "Antarctica/South_Pole") /// /// @@ -401,12 +404,21 @@ fn read_data_from_disk(config: &Config) -> Result { Ok(data) } -fn process_data(data: &Data, now: DateTime) -> Result>> { +fn process_data<'a>( + data: &'a Data, + hide_uids: &'a BTreeSet, + now: DateTime, +) -> Result>> { let params = Parameters::new(now)?; let mut instances = vec![]; for (ical, config) in &data.icals { for ei in ical.event_instances(¶ms)? { + if let Some(uid) = ei.ev.get_uid() + && hide_uids.contains(uid) + { + continue; + } let ei = EventWithUrl::from_ei(config, ei)?; instances.push(ei); } @@ -505,8 +517,12 @@ fn output_html( maud::html! { (ei.calendar.short_name)} }; + // This is where the main stuff happens + + tracing::debug!(uid = ei.ev.get_uid(), summary = ei.ev.get_summary()); day_list.push(maud::html! { - li { p { (time) " - " (summary) } + li { details { + summary { (time) " - " (summary) } ul { li { (calendar_link) " calendar" } @if let Some(location) = location { @@ -514,7 +530,7 @@ fn output_html( } } } - }); + } }); } } // FIXME: De-dupe @@ -623,7 +639,7 @@ async fn do_everything(cli: &CliAuto) -> Result<()> { let tz = &config.output.timezone; let now = Utc::now().with_timezone(tz); - let instances = process_data(&data, now)?; + let instances = process_data(&data, &config.output.hide_uids, now)?; output_html(&config.output, &instances, now)?; Ok(()) } @@ -655,7 +671,7 @@ fn main_ics_debug(cli: CliIcsDebug) -> Result<()> { let tz = &config.output.timezone; let now = Utc::now().with_timezone(tz); - let instances = process_data(&data, now)?; + let instances = process_data(&data, &config.output.hide_uids, now)?; output_html(&config.output, &instances, now)?; Ok(())