Use feed::set_stylesheet instead of hack
This was contributed in https://github.com/rust-syndication/atom/pull/68. Closes #12. Signed-off-by: Jacob Kiers <jacob@jacobkiers.net>
This commit is contained in:
parent
3d7e5fc2cf
commit
cef6d5ad41
|
@ -29,8 +29,7 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
|
|||
[[package]]
|
||||
name = "atom_syndication"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21fb6a0b39c6517edafe46f8137e53c51742425a4dae1c73ee12264a37ad7541"
|
||||
source = "git+https://github.com/jacobkiers/atom-syndication?rev=525c41508db23634c565ea312bfedb51b5bd3deb#525c41508db23634c565ea312bfedb51b5bd3deb"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"derive_builder",
|
||||
|
|
|
@ -19,3 +19,6 @@ imap = { version = "^2.4.1", default-features = false }
|
|||
mail-parser = "^0.8.0"
|
||||
rustls-connector = { version = "^0.16.1", default-features = false, features = [ "webpki-roots-certs", "quic" ] }
|
||||
sha2 = "^0.10.2"
|
||||
|
||||
[patch.crates-io]
|
||||
atom_syndication = { git = "https://github.com/jacobkiers/atom-syndication", rev = "525c41508db23634c565ea312bfedb51b5bd3deb" }
|
|
@ -109,9 +109,8 @@ fn build_feed(filename: &PathBuf, hostname: String, include_html: bool) -> Resul
|
|||
feed.set_updated(Utc::now());
|
||||
println!("Writing feed to {}", filename.display());
|
||||
|
||||
// TODO: Ugly hack because atom_syndication crate does not support style sheets.
|
||||
let feed_str = feed.to_string().as_str().replace(">\n<feed", ">\n<?xml-stylesheet href=\"feed.xsl\" type=\"text/xsl\"?>\n<feed");
|
||||
let _ = write_file(filename, feed_str)?;
|
||||
feed.set_stylesheet(Some("feed.xsl".into()));
|
||||
let _ = write_file(filename, feed.to_string())?;
|
||||
let _ = write_file(dir.join("feed.xsl"), FEED_STYLESHEET)?;
|
||||
|
||||
// Another ugly hack, but I don't know how to do this better...
|
||||
|
|
Loading…
Reference in New Issue