pub mod epub;
pub use epub::EpubParser;
use crate::core::models::ContentElement;
use crate::error::EpubError;
use std::collections::HashMap;
use std::io::{Read, Seek};
use zip::ZipArchive;
#[derive(Clone)]
pub struct ChapterInfo {
pub href: String,
pub id: String,
pub title: String,
pub level: usize,
}
pub trait Parser {
fn find_opf_path<R: Read + Seek>(
&self,
archive: &mut ZipArchive<R>,
) -> Result<String, EpubError>;
fn parse_opf<R: Read + Seek>(
&self,
archive: &mut ZipArchive<R>,
opf_path: &str,
) -> Result<
(
String,
String,
Vec<ChapterInfo>,
HashMap<String, String>,
Option<String>,
),
EpubError,
>;
fn parse_chapter_content(
&self,
content: &str,
index: usize,
href: &str,
) -> (String, Vec<ContentElement>);
}