.
diff --git a/README.md b/README.md
index 33eca9f..3fbcdba 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
-# Bibliofile
-### A TUI-based ebook reader that hopefully doesn't suck!
-
-A long long time ago, I was in college. I frequently bought the ebook versions of my textbooks, but to my dismay...most ebook readers sucked. The user interface was complicated, dark mode was unavailable for most readers until I neared graduation, dark mode usually looked terrible even if it was available, etc. I hope to change that. What better dark mode that running it on the TUI? What better way to make a simple UI than to design one myself that *I* like?
-
-This is very much a personal project. Rust isn't exactly used for big companies besides Mozilla just yet, and progress is slow-going due to my personal and work commitments. Still, when it is done, I will attempt to release it on several popular repositories such as Flatpack so that others can use it.
-
-Feel free to check up on progress on my blog, www.whoisthisjoker.com. I post there periodically to talk about what direction I want the project to go.
+# Bibliofile
+### A TUI-based ebook reader that hopefully doesn't suck!
+
+A long long time ago, I was in college. I frequently bought the ebook versions of my textbooks, but to my dismay...most ebook readers sucked. The user interface was complicated, dark mode was unavailable for most readers until I neared graduation, dark mode usually looked terrible even if it was available, etc. I hope to change that. What better dark mode that running it on the TUI? What better way to make a simple UI than to design one myself that *I* like?
+
+This is very much a personal project. Rust isn't exactly used for big companies besides Mozilla just yet, and progress is slow-going due to my personal and work commitments. Still, when it is done, I will attempt to release it on several popular repositories such as Flatpack so that others can use it.
+
+Feel free to check up on progress on my blog, www.whoisthisjoker.com. I post there periodically to talk about what direction I want the project to go.
diff --git a/src/html_module.rs b/src/html_module.rs
index cbb0c36..59ee423 100644
--- a/src/html_module.rs
+++ b/src/html_module.rs
@@ -1,25 +1,36 @@
-/*
-Program: Bibliofile
-Purpose: This class is meant to process and return HTML formatted text as strings.
-Last edited: 6/28/23
- */
-
-use scraper::{Html, Selector};
-
-pub fn main(content: String){
-
-
- let str_content = Html::parse_document(&content);
-
- //Selector is HTML tag. Can be
or or anything else. To parse entire page, set selector to
- let selector = Selector::parse("html").unwrap();
- let unwrapped_page = str_content.select(&selector).next().unwrap();
- let page = unwrapped_page.text().collect::>();
-
- //every line in document is an entry into the vector. For loop iterates through every entry and displays it.
- for i in 0..page.len() {
- println!("{}", page[i]);
- }
-
-
+/*
+Program: Bibliofile
+Purpose: This class is meant to process and return HTML formatted text as strings.
+Last edited: 7/20/23
+ */
+
+
+use scraper::{Html, Selector};
+
+pub fn main(content: String) -> String{
+
+
+ let str_content = Html::parse_document(&content);
+
+ //Selector is HTML tag. Can be
or or anything else. To parse entire page, set selector to
+ let selector = Selector::parse("html").unwrap();
+ let unwrapped_page = str_content.select(&selector).next().unwrap();
+ let page = unwrapped_page.text().collect::>();
+ let mut text = String::new();
+ //every line in document is an entry into the vector. For loop iterates through every entry and displays it.
+ for i in 0..page.len() {
+
+ if i < page.len() {
+ text = text + page[i];
+
+ }
+
+ if i == page.len(){
+ text = text + page[i];
+ return text.to_string();
+ }
+
+ }
+ return text.to_string();
+
}
\ No newline at end of file
diff --git a/src/main.rs b/src/main.rs
index e8d443b..1d7e2d1 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,93 +1,93 @@
-/*
-Program: Bibliofile
-Language: Rustc 1.70.0
-ide: CLion
-Operating system: Fedora 38/WSL
-Purpose: ncurses based ereader and library manager for Linux terminal environments.
-Last edited: 6/28/23
-*/
-//this is a test change to see if gitea is accepting pushes.
-
-mod html_module;
-
-
-use epub::doc::EpubDoc; //library for navigating epubs
-use std::env;
-use std::process::exit;
-
-
-//initial function. Reads the ebook passed by argument.
-//TODO: add visual library to pull up ebooks.
-fn main() {
- if env::args().len() == 1 {
- println!("you need to enter a book. Closing program.");
- }
- else {
- let args: Vec = env::args().collect();
- let filename = &args[1];
-
- epub_func(filename);
- }
-}
-
-
-//parses epub files
-fn epub_func(epub_file: &str){
-
- let doc = EpubDoc::new(&epub_file);
- assert!(doc.is_ok());
- let mut doc = doc.unwrap();
-
- let mut page_num = 1;
- let is_reading = true;
- while is_reading == true {
- let mut next_or_last = String::new();
- doc.set_current_page(page_num);
-
- let content = doc.get_current_str();
- let str_content = content.unwrap();
- html_module::main(str_content.0);
-
-
- let input_size = std::io::stdin().read_line(&mut next_or_last);
- let input_size_len = input_size.unwrap() - 1;
- if input_size_len == 1{
-
- /*
- Was not sure how to compare string to input from .read_line
- Instead, I felt that it would be easier to convert it to bytes and
- compare the ASCII values.
- */
- let compare = next_or_last.as_bytes();
-
- //If user presses n(for next) goes forward one page.
- if compare[0] == 110 {
- page_num = page_num + 1;
- }
- //if user presses b, goes back one page.
- else if compare[0] == 98 {
- //if page number equals one then you are at the beginning of the book.
- if page_num == 1 {
- println!("at beginning of book.");
- }
- else {
- page_num = page_num - 1;
- }
- }
- //If user presses q(for quit), exits with status code of 0.
- else if compare[0] == 113 {
- println!("quitting...");
- exit(0);
- }
- else {
- println!("did not understand command.");
- }
- }
- else {
- println!("Do not understand input. Try again.");
- }
- }
-}
-
-
-
+/*
+Program: Bibliofile
+Language: Rustc 1.70.0
+ide: CLion
+Operating system: Fedora 38/WSL
+Purpose: TUI-based ereader and library manager for Linux terminal environments.
+Last edited: 7/20/23
+*/
+//this is a test change to see if gitea is accepting pushes.
+
+mod html_module;
+
+
+use epub::doc::EpubDoc; //library for navigating epubs
+use std::env;
+use std::process::exit;
+
+
+//initial function. Reads the ebook passed by argument.
+//TODO: add visual library to pull up ebooks.
+fn main() {
+ if env::args().len() == 1 {
+ println!("you need to enter a book. Closing program.");
+ }
+ else {
+ let args: Vec = env::args().collect();
+ let filename = &args[1];
+
+ epub_func(filename);
+ }
+}
+
+
+//parses epub files
+fn epub_func(epub_file: &str){
+
+ let doc = EpubDoc::new(&epub_file);
+ assert!(doc.is_ok());
+ let mut doc = doc.unwrap();
+
+ let mut page_num = 1;
+ let is_reading = true;
+ while is_reading == true {
+ let mut next_or_last = String::new();
+ doc.set_current_page(page_num);
+
+ let content = doc.get_current_str();
+ let str_content = content.unwrap();
+ let text = html_module::main(str_content.0);
+ println!("{}", text);
+
+ let input_size = std::io::stdin().read_line(&mut next_or_last);
+ let input_size_len = input_size.unwrap() - 1;
+ if input_size_len == 1{
+
+ /*
+ Was not sure how to compare string to input from .read_line
+ Instead, I felt that it would be easier to convert it to bytes and
+ compare the ASCII values.
+ */
+ let compare = next_or_last.as_bytes();
+
+ //If user presses n(for next) goes forward one page.
+ if compare[0] == 110 {
+ page_num = page_num + 1;
+ }
+ //if user presses b, goes back one page.
+ else if compare[0] == 98 {
+ //if page number equals one then you are at the beginning of the book.
+ if page_num == 1 {
+ println!("at beginning of book.");
+ }
+ else {
+ page_num = page_num - 1;
+ }
+ }
+ //If user presses q(for quit), exits with status code of 0.
+ else if compare[0] == 113 {
+ println!("quitting...");
+ exit(0);
+ }
+ else {
+ println!("did not understand command.");
+ }
+ }
+ else {
+ println!("Do not understand input. Try again.");
+ }
+ }
+}
+
+
+