[−][src]Function bloguen::ops::feed_atom_post_header
pub fn feed_atom_post_header<W, E, Tz>(
post_name: &str,
post_id_name: &str,
language: &LanguageTag,
author: &str,
base: &str,
link: &str,
post_date: &DateTime<Tz>,
into: &mut W,
out_name_err: E
) -> Result<Cow<'static, str>, Error> where
Tz: TimeZone,
W: Write,
E: Into<Cow<'static, str>>,
Output the post header for an Atom feed,
The post_id_name
argment is used as the entry GUID,
the base
argument is the xml:base
attribute, and should point to thr posts output directory to properly handle image
links,
the link
argument points to the corresponding post HTML.
Examples
let mut out = vec![]; let res = feed_atom_post_header( "release-front - a generic release front-end, like Patchwork's", "003. 2018-02-05 release-front - a generic release front-end, like Patchwork's", &LANGUAGE_EN_GB, "nabijaczleweli", "../posts/", "../posts/003. 2018-02-05 release-front - a generic release front-end, like Patchwork's.html", &DateTime::parse_from_rfc3339("2018-09-06T18:32:22+02:00").unwrap(), &mut out, "test post"); assert_eq!(res, Ok("test post".into())); let out = str::from_utf8(&out).unwrap(); assert_eq!(out, r###" <entry> <title>release-front - a generic release front-end, like Patchwork's</title> <contributor> <name>nabijaczleweli</name> </contributor> <link rel="alternate" href="../posts/003. 2018-02-05 release-front - a generic release front-end, like Patchwork's.html" /> <updated>2018-09-06T18:32:22+02:00</updated> <published>2018-09-06T18:32:22+02:00</published> <guid>urn:uuid:4e2f9fbd-6b4e-52cc-bcc7-635e384f1cd9</guid> <content type="html" xml:lang="en-GB" xml:base="../posts/"> "###);