2023-05-15 18:33:14 +00:00
|
|
|
/*
|
|
|
|
Program: Bibliofile
|
|
|
|
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.
|
2023-05-21 01:03:54 +00:00
|
|
|
Last edited: 5/20/23
|
2023-05-15 18:33:14 +00:00
|
|
|
*/
|
2023-05-20 00:13:38 +00:00
|
|
|
//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)
|
|
|
|
*/
|
2023-05-20 23:44:13 +00:00
|
|
|
use soup::{Soup};
|
2023-05-15 18:33:14 +00:00
|
|
|
|
2023-05-19 23:44:10 +00:00
|
|
|
pub fn main(content: String) -> String {
|
2023-05-20 23:44:13 +00:00
|
|
|
let str_content = content;
|
2023-05-19 23:15:48 +00:00
|
|
|
let soup = Soup::new(&str_content);
|
2023-05-19 23:44:10 +00:00
|
|
|
let page = soup.text();
|
|
|
|
return page;
|
2023-05-15 18:33:14 +00:00
|
|
|
}
|