1
0
mirror of https://github.com/lise-henry/crowbook synced 2024-09-23 06:01:02 +02:00

Move to name changes in EpubBuilder

This commit is contained in:
Elisabeth Henry 2017-01-02 21:39:27 +01:00
parent bd1e263232
commit 9343c0633c
6 changed files with 21 additions and 20 deletions

9
Cargo.lock generated
View File

@ -3,13 +3,12 @@ name = "crowbook"
version = "0.11.1-pre"
dependencies = [
"caribon 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.19.3 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"crowbook-intl 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crowbook-intl-runtime 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crowbook-text-processing 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"epub 0.0.1-pre (git+https://github.com/lise-henry/epub.git)",
"epub-builder 0.0.1-pre (git+https://github.com/lise-henry/epub-builder.git)",
"hyper 0.9.14 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -177,9 +176,9 @@ dependencies = [
]
[[package]]
name = "epub"
name = "epub-builder"
version = "0.0.1-pre"
source = "git+https://github.com/lise-henry/epub.git#8aa7bbcfb77243154c92200ee68f5ca6d0f28b11"
source = "git+https://github.com/lise-henry/epub-builder.git#177b5dcd5f66f143a8ac1f43461b17770f9bc82a"
dependencies = [
"chrono 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -690,7 +689,7 @@ dependencies = [
"checksum crowbook-intl-runtime 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62cf6ec512b4d7fb7d8683efa703b17e5b8f5e24a9eb7ec9fb92237f039d941c"
"checksum crowbook-text-processing 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "19b36c133a7bfba2e67109078222033b0bfb083bcc0a67b67a2bb7000254798e"
"checksum dbghelp-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97590ba53bcb8ac28279161ca943a924d1fd4a8fb3fa63302591647c4fc5b850"
"checksum epub 0.0.1-pre (git+https://github.com/lise-henry/epub.git)" = "<none>"
"checksum epub-builder 0.0.1-pre (git+https://github.com/lise-henry/epub-builder.git)" = "<none>"
"checksum error-chain 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "318cb3c71ee4cdea69fdc9e15c173b245ed6063e1709029e8fd32525a881120f"
"checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb"
"checksum gcc 0.3.41 (registry+https://github.com/rust-lang/crates.io-index)" = "3689e1982a563af74960ae3a4758aa632bb8fd984cfc3cc3b60ee6109477ab6e"

View File

@ -43,7 +43,6 @@ mime_guess = "1"
pulldown-cmark = "0.0.8"
yaml-rust = "0.3"
mustache = "0.8"
chrono = "0.2"
uuid = { version = "0.3", features = ["v4"] }
walkdir = "1.0"
rustc-serialize = "0.3"
@ -56,7 +55,7 @@ caribon = { version = "0.7", optional = true }
clap = { version = "2", optional = true }
url = { version = "1", optional = true }
numerals = "0.1"
epub = { git = "https://github.com/lise-henry/epub.git" }
epub-builder = { git = "https://github.com/lise-henry/epub-builder.git" }
[dependencies.hyper]
version = "0.9"

View File

@ -29,7 +29,10 @@ use book_renderer::BookRenderer;
use mustache::Template;
use crowbook_text_processing::escape;
use epub_maker;
use epub_builder::EpubBuilder;
use epub_builder::EpubVersion;
use epub_builder::EpubContent;
use epub_builder::ZipCommand;
use std::io::Write;
use std::convert::{AsRef, AsMut};
@ -65,12 +68,12 @@ impl<'a> EpubRenderer<'a> {
/// Render a book
pub fn render_book(&mut self, to: &mut Write) -> Result<String> {
// Initialize the EPUB builder
let mut zip = epub_maker::ZipCommand::new_in(self.html.book.options.get_path("crowbook.temp_dir")?)?;
let mut zip = ZipCommand::new_in(self.html.book.options.get_path("crowbook.temp_dir")?)?;
zip.command(self.html.book.options.get_str("crowbook.zip.command")
.unwrap());
let mut maker = epub_maker::Epub::new(zip)?;
let mut maker = EpubBuilder::new(zip)?;
if self.html.book.options.get_i32("epub.version").unwrap() == 3 {
maker.epub_version(epub_maker::EpubVersion::V3_0);
maker.epub_version(EpubVersion::V30);
}
let lang = self.html.book.options.get_str("lang").unwrap();
@ -123,7 +126,7 @@ impl<'a> EpubRenderer<'a> {
// Write cover.xhtml (if needs be)
if self.html.book.options.get_path("cover").is_ok() {
let cover = self.render_cover()?;
let mut content = epub_maker::EpubContent::new("cover.xhtml", cover.as_bytes());
let mut content = EpubContent::new("cover.xhtml", cover.as_bytes());
if toc_extras {
content = content.title(lang::get_str(lang, "cover"));
}
@ -133,7 +136,7 @@ impl<'a> EpubRenderer<'a> {
// Write titlepage
{
let title_page = self.render_titlepage()?;
let mut content = epub_maker::EpubContent::new("title_page.xhtml", title_page.as_bytes());
let mut content = EpubContent::new("title_page.xhtml", title_page.as_bytes());
if toc_extras {
content = content.title(lang::get_str(lang, "title"));
}
@ -152,7 +155,7 @@ impl<'a> EpubRenderer<'a> {
let chapter = self.render_chapter(v, &template_chapter)?;
// TODO: deal with toc discrepancies
let mut content = epub_maker::EpubContent::new(filenamer(i), chapter.as_bytes());
let mut content = EpubContent::new(filenamer(i), chapter.as_bytes());
// horrible hack
// todo: find cleaner way
for element in self.html.toc.elements.iter() {

View File

@ -16,7 +16,7 @@
// along with Crowbook. If not, see <http://www.gnu.org/licenses/>.
use mustache;
use epub_maker;
use epub_builder;
use std::error;
use std::result;
@ -368,8 +368,8 @@ impl From<mustache::Error> for Error {
}
/// Implement our error from epub_maker::Error
impl From<epub_maker::Error> for Error {
fn from(err: epub_maker::Error) -> Error {
impl From<epub_builder::Error> for Error {
fn from(err: epub_builder::Error) -> Error {
Error::render(Source::empty(),
lformat!("error during EPUB generation: {}", err))
}

View File

@ -30,8 +30,8 @@ use std::convert::{AsMut, AsRef};
use crowbook_text_processing::escape;
use numerals::roman::Roman;
use epub_maker::Toc;
use epub_maker::TocElement;
use epub_builder::Toc;
use epub_builder::TocElement;
#[cfg(feature = "proofread")]
use caribon::Parser as Caribon;

View File

@ -115,7 +115,7 @@ extern crate crowbook_text_processing;
extern crate crowbook_intl_runtime;
extern crate term;
extern crate numerals;
extern crate epub as epub_maker;
extern crate epub_builder;
extern crate uuid;
#[macro_use]
extern crate lazy_static;