From 14eb1a482e7eca87d12e499056e58fc7e92a71db Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Thu, 18 May 2023 22:01:14 -0500 Subject: [PATCH] Got the string passed to the HTML Module. Content is so I unwrapped it and saved the value as only a string. Tomorrow I parse the HTML in html_module. --- src/html_module.rs | 10 +++++++--- src/main.rs | 32 +++++++++++--------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/html_module.rs b/src/html_module.rs index b424ddc..cdb4d2d 100644 --- a/src/html_module.rs +++ b/src/html_module.rs @@ -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; } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 79db2bc..78e79c3 100644 --- a/src/main.rs +++ b/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 = 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 next = String::new(); + 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); }