grab epub text
Got it to grab the text. It is formatted as HTML so next step is to parse that.
This commit is contained in:
parent
383457db62
commit
0dc6e19dd1
@ -6,6 +6,4 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ncurses = "5.101.0"
|
|
||||||
termsize = "0.1"
|
|
||||||
epub = "1.2.2"
|
epub = "1.2.2"
|
18
src/main.rs
18
src/main.rs
@ -8,11 +8,7 @@ Last edited: 5/1/23
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use epub::doc::EpubDoc;
|
use epub::doc::EpubDoc;
|
||||||
use std::fs;
|
|
||||||
use std::io::prelude::*;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
extern crate ncurses; //display framework
|
|
||||||
extern crate termsize; //makes sure ncurses border maches term size
|
|
||||||
|
|
||||||
|
|
||||||
//initial function. Reads the ebook passed by argument.
|
//initial function. Reads the ebook passed by argument.
|
||||||
@ -27,15 +23,17 @@ fn main() {
|
|||||||
|
|
||||||
//parses epub files
|
//parses epub files
|
||||||
fn epub(epub_file: &str){
|
fn epub(epub_file: &str){
|
||||||
let item_count = 0;
|
let item_count = 1;
|
||||||
println!("{}", epub_file);
|
println!("{}", epub_file);
|
||||||
let doc = EpubDoc::new(&epub_file);
|
let doc = EpubDoc::new(&epub_file);
|
||||||
assert!(doc.is_ok());
|
assert!(doc.is_ok());
|
||||||
let doc = doc.unwrap();
|
let mut doc = doc.unwrap();
|
||||||
assert_eq!(105, doc.spine.len());
|
doc.set_current_page(50);
|
||||||
let page = &doc.spine[item_count];
|
let content = doc.get_current_str();
|
||||||
let text = doc.resources.get(page);
|
|
||||||
println!("{:?}", text);
|
|
||||||
|
println!("{:?}", content);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user