This commit is contained in:
Rakarake 2026-03-28 00:03:28 +01:00
parent b0168c05be
commit ac5cba1c4d
8 changed files with 19 additions and 17 deletions

View file

@ -34,7 +34,7 @@ fn main() -> io::Result<()> {
let mut channel = Channel::default();
channel.title = "MDF blog huge".to_string();
channel.link = "https://mdf.farm".to_string();
channel.description = "morbius text wow".to_string();
channel.description = "The MDF blog".to_string();
channel.generator = Some("Rakabaka's tooling".to_string());
channel.items = posts.iter().map(|(body, metadata)| {
let guid = metadata.get("guid").map(|guid|
@ -58,7 +58,9 @@ fn main() -> io::Result<()> {
let guid = metadata.get("guid").unwrap_or(&i.to_string()).clone();
let title = metadata.get("title").map(|title| format!("<h1>{title}</h1>")).unwrap_or("".to_string());
let pub_date = metadata.get("pubDate").map(|pub_date| format!("<i>{pub_date}</i>")).unwrap_or("".to_string());
format!("<div class=\"blogpost\" id={guid}>{title}{body}{pub_date}</div>")
let author = metadata.get("author").map(|author| format!("<i>{author}</i>")).unwrap_or("".to_string());
format!("<div class=\"blogpost\" id={guid}>{title}{body}<p>{author} - {pub_date}</p></div>")
}).collect::<Vec<String>>().concat())
},
"new" => {
@ -70,9 +72,9 @@ fn main() -> io::Result<()> {
let mut author = String::new();
io::stdin().read_line(&mut author).unwrap();
let pub_date = chrono::Utc::now();
let pub_date = chrono::Utc::now().format("%a, %b %e %Y");
print!("title: {title}author: {author}pubDate: {pub_date}");
print!("title: {title}author: {author}pubDate: {pub_date}\n---\n");
},
_ => eprintln!("need to specify 'rss', 'html' or 'new'"),
}