diff --git a/src/epub.rs b/src/epub.rs index dddd111..221684d 100644 --- a/src/epub.rs +++ b/src/epub.rs @@ -13,6 +13,7 @@ use std::io; use std::io::Read; use std::path::Path; use std::str::FromStr; +use upon::Engine; /// Represents the EPUB version. /// @@ -720,8 +721,8 @@ impl EpubBuilder { let mut res: Vec = vec![]; match self.version { - EpubVersion::V20 => templates::v2::CONTENT_OPF.render(&data).to_writer(&mut res), - EpubVersion::V30 => templates::v3::CONTENT_OPF.render(&data).to_writer(&mut res), + EpubVersion::V20 => templates::v2::CONTENT_OPF.render(&Engine::new(), &data).to_writer(&mut res), + EpubVersion::V30 => templates::v3::CONTENT_OPF.render(&Engine::new(), &data).to_writer(&mut res), } .map_err(|e| crate::Error::TemplateError { msg: "could not render template for content.opf".to_string(), @@ -812,8 +813,8 @@ impl EpubBuilder { let mut res: Vec = vec![]; match self.version { - EpubVersion::V20 => templates::v2::NAV_XHTML.render(&data).to_writer(&mut res), - EpubVersion::V30 => templates::v3::NAV_XHTML.render(&data).to_writer(&mut res), + EpubVersion::V20 => templates::v2::NAV_XHTML.render(&Engine::new(), &data).to_writer(&mut res), + EpubVersion::V30 => templates::v3::NAV_XHTML.render(&Engine::new(), &data).to_writer(&mut res), } .map_err(|e| crate::Error::TemplateError { msg: "error rendering nav.xhtml template".to_string(), diff --git a/src/zip_library.rs b/src/zip_library.rs index f6e045c..f75ba0f 100644 --- a/src/zip_library.rs +++ b/src/zip_library.rs @@ -12,7 +12,6 @@ use std::io::Write; use std::path::Path; use crate::Result; -use libzip::write::FileOptions; use libzip::CompressionMethod; use libzip::ZipWriter; @@ -43,7 +42,7 @@ impl ZipLibrary { writer.set_comment(""); // Fix issues with some readers writer.start_file( "mimetype", - FileOptions::default().compression_method(CompressionMethod::Stored), + libzip::write::SimpleFileOptions::default().compression_method(CompressionMethod::Stored), )?; writer .write(b"application/epub+zip") @@ -63,7 +62,7 @@ impl Zip for ZipLibrary { // Path names should not use backspaces in zip files file = file.replace('\\', "/"); } - let options = FileOptions::default(); + let options = libzip::write::SimpleFileOptions::default(); self.writer.start_file(file.clone(), options).map_err(|e| { crate::Error::ZipErrorWithMessage { msg: format!("could not create file '{}' in epub", file), @@ -77,7 +76,7 @@ impl Zip for ZipLibrary { Ok(()) } - fn generate(&mut self, mut to: W) -> Result<()> { + fn generate(self, mut to: W) -> Result<()> { let cursor = self .writer .finish()