fn create_jsonfeed(path: &str, dest: &Path, config: &Config, posts: &[Document]) -> Result<()> {
    let jsonfeed_path = dest.join(path);
    debug!("Creating jsonfeed file at {}", jsonfeed_path.display());

    let title = &config.posts.title;
    let description = config
        .posts
        .description
        .as_ref()
        .map(|s| s.as_str())
        .unwrap_or("");
    let link = config
        .site
        .base_url
        .as_ref()
        .ok_or(ErrorKind::ConfigFileMissingFields)?;

    let jsonitems = posts.iter().map(|doc| doc.to_jsonfeed(link)).collect();

    let feed = Feed {
        title: title.to_string(),
        items: jsonitems,
        home_page_url: Some(link.to_string()),
        description: Some(description.to_string()),
        ..Default::default()
    };

    let jsonfeed_string = jsonfeed::to_string(&feed).unwrap();
    files::write_document_file(jsonfeed_string, jsonfeed_path)?;

    Ok(())
}
// creates a new jsonfeed file with the contents of the site blog
creates a new jsonfeed file with the contents of the site blog
creates a new jsonfeed file with the contents of the site blog
fn create_jsonfeed(path: &str, dest: &Path, config: &Config, posts: &[Document]) -> Result<()> {
    let jsonfeed_path = dest.join(path);
    debug!("Creating jsonfeed file at {}", jsonfeed_path.display());
    let title = &config.posts.title;
    let description = config
        .posts
        .description
        .as_ref()
        .map(|s| s.as_str())
        .unwrap_or("");
    let link = config
        .site
        .base_url
        .as_ref()
        .ok_or(ErrorKind::ConfigFileMissingFields)?;
    let jsonitems = posts.iter().map(|doc| doc.to_jsonfeed(link)).collect();
    let feed = Feed {
        title: title.to_string(),
        items: jsonitems,
        home_page_url: Some(link.to_string()),
        description: Some(description.to_string()),
        ..Default::default()
    };
    let jsonfeed_string = jsonfeed::to_string(&feed).unwrap();
    files::write_document_file(jsonfeed_string, jsonfeed_path)?;
    Ok(())
}
fn create_jsonfeed ( path : & str , dest : & Path , config : & Config , posts : & [ Document ] ) -> Result < ( ) > { let jsonfeed_path = dest . join ( path ) ; debug ! ( " " jsonfeed_path display ( ) ) ; let title = & config . posts . title ; let description = config . posts . description . as_ref ( ) . map ( | s | s . as_str ( ) ) . unwrap_or ( " " ) ; let link = config . site . base_url . as_ref ( ) . ok_or ( ErrorKind :: ConfigFileMissingFields ) ? ; let jsonitems = posts . iter ( ) . map ( | doc | doc . to_jsonfeed ( link ) ) . collect ( ) ; let feed = Feed { title : title . to_string ( ) , items : jsonitems , home_page_url : Some ( link . to_string ( ) ) , description : Some ( description . to_string ( ) ) , .. Default :: default ( ) } ; let jsonfeed_string = jsonfeed :: to_string ( & feed ) . unwrap ( ) ; files :: write_document_file ( jsonfeed_string , jsonfeed_path ) ? ; Ok ( ( ) ) }
creates a new jsonfeed file with the contents of the site blog
creates a new jsonfeed file with the contents of the site blog
path
&str
dest
&Path
config
&Config
posts
&[Document]
path
&str
dest
&Path
config
&Config
posts
&[Document]