diff --git a/Cargo.lock b/Cargo.lock index 89b2e6b..983df14 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -876,7 +876,7 @@ dependencies = [ [[package]] name = "jsonfeed" -version = "0.2.0" +version = "0.3.0" dependencies = [ "error-chain", "serde", diff --git a/lib/jsonfeed/Cargo.toml b/lib/jsonfeed/Cargo.toml index affc5a6..e85ee46 100644 --- a/lib/jsonfeed/Cargo.toml +++ b/lib/jsonfeed/Cargo.toml @@ -1,12 +1,12 @@ [package] -authors = ["Paul Woolcock "] +authors = ["Paul Woolcock ", "Christine Dodrill "] description = "Parser for the JSONFeed (http://jsonfeed.org) specification\n" documentation = "https://docs.rs/jsonfeed" homepage = "https://github.com/pwoolcoc/jsonfeed" license = "MIT/Apache-2.0" name = "jsonfeed" readme = "README.adoc" -version = "0.2.0" +version = "0.3.0" [dependencies] error-chain = "0.12" diff --git a/lib/jsonfeed/src/builder.rs b/lib/jsonfeed/src/builder.rs index 5194b11..f17740f 100644 --- a/lib/jsonfeed/src/builder.rs +++ b/lib/jsonfeed/src/builder.rs @@ -151,6 +151,11 @@ impl ItemBuilder { self } + pub fn author(mut self, who: Author) -> ItemBuilder { + self.author = Some(who); + self + } + pub fn content_html>(mut self, i: I) -> ItemBuilder { match self.content { Some(Content::Text(t)) => { diff --git a/src/post/mod.rs b/src/post/mod.rs index 4bb6d50..b0bb3a6 100644 --- a/src/post/mod.rs +++ b/src/post/mod.rs @@ -20,9 +20,16 @@ impl Into for Post { let mut result = jsonfeed::Item::builder() .title(self.front_matter.title) .content_html(self.body_html) + .content_text(self.body) .id(format!("https://christine.website/{}", self.link)) .url(format!("https://christine.website/{}", self.link)) - .date_published(self.date.to_rfc3339()); + .date_published(self.date.to_rfc3339()) + .author( + jsonfeed::Author::new() + .name("Christine Dodrill") + .url("https://christine.website") + .avatar("https://christine.website/static/img/avatar.png"), + ); let mut tags: Vec = vec![]; @@ -57,6 +64,16 @@ impl Into for Post { let content = content.build().unwrap(); let mut result = atom::EntryBuilder::default(); + result.id(format!("https://christine.website/{}", self.link)); + result.contributors({ + let mut me = atom::Person::default(); + + me.set_name("Christine Dodrill"); + me.set_email("me@christine.website".to_string()); + me.set_uri("https://christine.website".to_string()); + + vec![me] + }); result.title(self.front_matter.title); let mut link = atom::Link::default(); link.href = format!("https://christine.website/{}", self.link); @@ -76,7 +93,7 @@ impl Into for Post { result.title(Some(self.front_matter.title)); result.link(format!("https://christine.website/{}", self.link)); result.guid(guid); - result.author(Some("Christine Dodrill ".to_string())); + result.author(Some("me@christine.website (Christine Dodrill)".to_string())); result.content(self.body_html); result.pub_date(self.date.to_rfc2822());