Got the string passed to the HTML Module. Content is <String, Error> so I unwrapped it and saved the value as only a string. Tomorrow I parse the HTML in html_module.
This commit is contained in:
parent
e7dfddc8f8
commit
14eb1a482e
@ -4,14 +4,18 @@ Language: Rustc 1.69.0
|
||||
ide: CLion
|
||||
Operating system: Fedora 38/WSL
|
||||
Purpose: This class is meant to process and return HTML formatted text as strings.
|
||||
Last edited: 5/15/23
|
||||
Last edited: 5/18/23
|
||||
*/
|
||||
|
||||
extern crate horrorshow;
|
||||
use epub::archive;
|
||||
use horrorshow::prelude::*;
|
||||
use horrorshow::helper::doctype;
|
||||
|
||||
|
||||
pub fn main(){
|
||||
println!("if you can read this, you reached the HTML class.");
|
||||
pub fn main(content: String) -> String{
|
||||
|
||||
println!("IF YOU CAN READ THIS, I HAVE ENTERED THE HTML MODULE");
|
||||
let mut str_content = content;
|
||||
return str_content;
|
||||
}
|
28
src/main.rs
28
src/main.rs
@ -4,7 +4,7 @@ Language: Rustc 1.69.0
|
||||
ide: CLion
|
||||
Operating system: Fedora 38/WSL
|
||||
Purpose: ncurses based ereader and library manager for Linux terminal environments.
|
||||
Last edited: 5/15/23
|
||||
Last edited: 5/18/23
|
||||
*/
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ mod html_module;
|
||||
use epub::doc::EpubDoc; //library for navigating epubs
|
||||
use std::env;
|
||||
use std::io;
|
||||
|
||||
use horrorshow::Template;
|
||||
|
||||
|
||||
//initial function. Reads the ebook passed by argument.
|
||||
@ -20,36 +20,26 @@ use std::io;
|
||||
fn main() {
|
||||
let args: Vec<String> = env::args().collect();
|
||||
let filename = &args[1];
|
||||
epub(filename);
|
||||
epub_func(filename);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//parses epub files
|
||||
fn epub(epub_file: &str){
|
||||
let item_count = 1;
|
||||
fn epub_func(epub_file: &str){
|
||||
//let item_count = 1;
|
||||
let doc = EpubDoc::new(&epub_file);
|
||||
assert!(doc.is_ok());
|
||||
let mut doc = doc.unwrap();
|
||||
doc.set_current_page(50);
|
||||
let content = doc.get_current_str();
|
||||
|
||||
//while true{
|
||||
let mut content = doc.get_current_str();
|
||||
let mut str_content = content.unwrap();
|
||||
let mut next = String::new();
|
||||
|
||||
io::stdin()
|
||||
.read_line(&mut next)
|
||||
.expect("Failed to read line");
|
||||
//if next == "n"{
|
||||
doc.go_next();
|
||||
println!("{:?}", content);
|
||||
//}
|
||||
|
||||
html_module::main();
|
||||
|
||||
//}
|
||||
|
||||
|
||||
str_content = html_module::main(str_content);
|
||||
println!("{}", str_content);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user