stuff happened
This commit is contained in:
@ -13,7 +13,8 @@ pub struct RssEntry {
|
||||
|
||||
impl From<posts::Post> for RssEntry {
|
||||
fn from(post: posts::Post) -> Self {
|
||||
let web_url = std::env::var("BASE_URI_WEB").expect("Environment variable not found");
|
||||
let web_url =
|
||||
std::env::var("BASE_URI_WEB").expect("Environment variable BASE_URI_WEB not found");
|
||||
let post_url = format!("{}{}{}", web_url, "/posts/", post.post_id.to_string());
|
||||
let author_full_name = format!("{} {}", post.first_name.unwrap(), post.last_name.unwrap());
|
||||
|
||||
@ -58,10 +59,7 @@ pub fn generate_rss(
|
||||
link: &str,
|
||||
posts: &HashMap<String, posts::Post>,
|
||||
) -> String {
|
||||
println!("{:?}", posts);
|
||||
let values = posts.clone().into_values();
|
||||
println!("{:?}", values);
|
||||
|
||||
let rss_entries = values
|
||||
.map(|p| p.into())
|
||||
.map(|r: RssEntry| r.to_item())
|
||||
@ -69,8 +67,9 @@ pub fn generate_rss(
|
||||
|
||||
let safe_title = escape_str_pcdata(title);
|
||||
let safe_description = escape_str_pcdata(description);
|
||||
println!("{:?}", rss_entries);
|
||||
|
||||
// TODO: change the atom link in this string - it's not correct
|
||||
// change it when we know the URL
|
||||
format!(
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
|
Reference in New Issue
Block a user