Getting error "assertion failed" when running. Backing up to github until I figure something out.
This commit is contained in:
parent
14eb1a482e
commit
f491225902
@ -7,4 +7,5 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
epub = "1.2.2"
|
epub = "1.2.2"
|
||||||
horrorshow = "0.8.4"
|
regex = "1.8.1"
|
||||||
|
soup = "0.5.1"
|
||||||
|
@ -7,15 +7,30 @@ Purpose: This class is meant to process and return HTML formatted text as string
|
|||||||
Last edited: 5/18/23
|
Last edited: 5/18/23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern crate horrorshow;
|
|
||||||
|
use regex::Regex;
|
||||||
use epub::archive;
|
use epub::archive;
|
||||||
use horrorshow::prelude::*;
|
use soup::{NodeExt, QueryBuilderExt, Soup};
|
||||||
use horrorshow::helper::doctype;
|
|
||||||
|
|
||||||
|
|
||||||
pub fn main(content: String) -> String{
|
pub fn main(content: String) -> String{
|
||||||
|
|
||||||
println!("IF YOU CAN READ THIS, I HAVE ENTERED THE HTML MODULE");
|
println!("IF YOU CAN READ THIS, I HAVE ENTERED THE HTML MODULE");
|
||||||
|
|
||||||
|
|
||||||
let mut str_content = content;
|
let mut str_content = content;
|
||||||
return str_content;
|
let soup = Soup::new(&str_content);
|
||||||
|
let results = soup.tag(true)
|
||||||
|
.find_all()
|
||||||
|
.map(|tag| tag.name().to_string())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
assert_eq!(results, vec![
|
||||||
|
"html".to_string(),
|
||||||
|
"head".to_string(),
|
||||||
|
"body".to_string(),
|
||||||
|
"p".to_string(),
|
||||||
|
"b".to_string(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return results.join("\n");
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ mod html_module;
|
|||||||
use epub::doc::EpubDoc; //library for navigating epubs
|
use epub::doc::EpubDoc; //library for navigating epubs
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::io;
|
use std::io;
|
||||||
use horrorshow::Template;
|
|
||||||
|
|
||||||
|
|
||||||
//initial function. Reads the ebook passed by argument.
|
//initial function. Reads the ebook passed by argument.
|
||||||
@ -38,8 +38,8 @@ fn epub_func(epub_file: &str){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
str_content = html_module::main(str_content);
|
let page = html_module::main(str_content);
|
||||||
println!("{}", str_content);
|
println!("{}", page);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user