From 65b7e5ecc0680eca041aa3c5f26baaa926763c22 Mon Sep 17 00:00:00 2001 From: Daniel Jones <104509116+DanielReddJones@users.noreply.github.com> Date: Wed, 28 Jun 2023 12:16:04 -0500 Subject: [PATCH] Commit to scraper_framework branch - changing framework from Soup to Scraper - removed ncurses library. Will use different library instead. --- Cargo.toml | 3 ++- src/html_module.rs | 19 ++++++++----------- src/main.rs | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2fbd135..80be517 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,4 +8,5 @@ edition = "2021" [dependencies] epub = "1.2.2" ncurses = "5.101.0" -soup = "0.5.1" +scraper = "0.17.1" + diff --git a/src/html_module.rs b/src/html_module.rs index e80b9b5..c893443 100644 --- a/src/html_module.rs +++ b/src/html_module.rs @@ -4,20 +4,17 @@ 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/20/23 +Last edited: 6/28/23 */ -//TODO: I received a warning that soup is going to be incompatible in a future version, as it uses an old version of html5ever. -/*Possible solutions: - - Convert to html5ever - - find alternative library/framework - - convert html module to python script, use python version of soup - - convert html by hand(absolutely not) - */ -use soup::{Soup}; + +use scraper::{Html, Selector}; pub fn main(content: String) -> String { let str_content = content; - let soup = Soup::new(&str_content); - let page = soup.text(); + + println!("{}", str_content); + + let page = str_content; + return page; } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 1ed2a5a..ecce242 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ Last edited: 5/19/23 mod html_module; -mod ncurses_module; + use epub::doc::EpubDoc; //library for navigating epubs use std::env; @@ -25,7 +25,7 @@ fn main() { else { let args: Vec = env::args().collect(); let filename = &args[1]; - ncurses_module::main(); + epub_func(filename); } }