- Can now format HTML

- No longer returns to main.rs. Main function in html_module.rs now reads to console locally.
This commit is contained in:
Daniel Jones 2023-06-28 12:53:13 -05:00
parent fd9ce23a96
commit 47cf88ef55
2 changed files with 12 additions and 7 deletions

View File

@ -9,12 +9,17 @@ Last edited: 6/28/23
use scraper::{Html, Selector}; use scraper::{Html, Selector};
pub fn main(content: String) -> String { pub fn main(content: String){
let str_content = content;
println!("{}", str_content);
let page = str_content; let str_content = Html::parse_document(&content);
let selector = Selector::parse("html").unwrap();
let unwrapped_page = str_content.select(&selector).next().unwrap();
let page = unwrapped_page.text().collect::<Vec<_>>();
for i in 0..page.len() {
println!("{}", page[i]);
}
return page;
} }

View File

@ -46,8 +46,8 @@ fn epub_func(epub_file: &str){
let content = doc.get_current_str(); let content = doc.get_current_str();
let str_content = content.unwrap(); let str_content = content.unwrap();
let page = html_module::main(str_content); html_module::main(str_content);
println!("{}", page);
let input_size = std::io::stdin().read_line(&mut next_or_last); let input_size = std::io::stdin().read_line(&mut next_or_last);
let input_size_len = input_size.unwrap() - 1; let input_size_len = input_size.unwrap() - 1;