stupid windows crlf
This commit is contained in:
parent
aac1423638
commit
3b289b5e2f
1 changed files with 8 additions and 5 deletions
13
src/main.rs
13
src/main.rs
|
@ -13,7 +13,8 @@ fn main() {
|
|||
let body = reqwest::blocking::get(doc_url + "/export?gid=0&format=txt")
|
||||
.unwrap()
|
||||
.text()
|
||||
.expect("Google doc download failed!");
|
||||
.expect("Google doc download failed!")
|
||||
.replace("\r\n", "\n"); // Normalize line endings
|
||||
|
||||
let announcement_matcher = Regex::new(r"(\w+day,? \w+ \d+) *((?:.|\n)+?)\n\w+day").unwrap();
|
||||
|
||||
|
@ -28,11 +29,15 @@ fn main() {
|
|||
.trim()
|
||||
.to_string();
|
||||
|
||||
let pretty_announcements = Regex::new("\\n+")
|
||||
// println!("{}", announcements);
|
||||
|
||||
let pretty_announcements = Regex::new(r"\n+")
|
||||
.unwrap()
|
||||
.replace_all(&announcements, "")
|
||||
.replace_all(&announcements, "\n")
|
||||
.to_string();
|
||||
|
||||
// println!("{}", pretty_announcements);
|
||||
|
||||
let description = &format_description!("[weekday] [month repr:long] [day] [year]");
|
||||
let parsed_date = Date::parse(&format!("{} 2025", date), description).unwrap();
|
||||
println!("Date: {:}", parsed_date);
|
||||
|
@ -42,8 +47,6 @@ fn main() {
|
|||
return;
|
||||
}
|
||||
|
||||
// println!("{}", pretty_announcements);
|
||||
|
||||
Webhook::new(webhook)
|
||||
.content(&format!("## {}:\n{}", date, pretty_announcements))
|
||||
.send()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue