From 038bb5e6410e13e7d1421dc67739f18ff884a16c Mon Sep 17 00:00:00 2001 From: Jacob Haddon Date: Fri, 13 Sep 2024 20:16:55 -0400 Subject: [PATCH] added more books to be processed --- books.pl | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/books.pl b/books.pl index 26fa742..14bff34 100755 --- a/books.pl +++ b/books.pl @@ -32,7 +32,7 @@ use DateTime; # While these have json formatting, they are JS files my $complete_books_js = "complete_books.js"; -my $book_pages_js = "book_pages2.js"; +my $book_pages_js = "book_pages.js"; # number of lines in a page my $number_of_lines = 31; @@ -68,6 +68,34 @@ my @books = ( url => "https://www.gutenberg.org/ebooks/121", file => "books/northangerabbey.txt", chapter_marker => "CHAPTER" + }, + { + title => "The Picture of Dorian Gray", + author => "Oscar Wilde", + url => "https://www.gutenberg.org/ebooks/174", + file => "books/doriangray.txt", + chapter_marker => "CHAPTER" + }, + { + title => "The Mysteries of Udolpho", + author => "Ann Ward Radcliffe", + url => "https://www.gutenberg.org/ebooks/3268", + file => "books/udolpho.txt", + chapter_marker => "CHAPTER" + }, + { + title => "The Enchanted Castle", + author => "E. Nesbit", + url => "https://www.gutenberg.org/ebooks/34219", + file => "books/enchantedcastle.txt", + chapter_marker => "CHAPTER" + }, + { + title => "Frankenstein", + author => "Mary Wollstonecraft Shelley", + url => "https://www.gutenberg.org/ebooks/84", + file => "books/frankenstein.txt", + chapter_marker => "Chapter" } ); # books hash @@ -77,6 +105,7 @@ my $json = new JSON; # Make the books into pages ################################### +# iterate over books my $k = 0; foreach (@books) { @@ -88,9 +117,11 @@ foreach (@books) { my @chapters = split('\n' . $books[$k]{'chapter_marker'}, $book); # go through each chapter and make pages based on number of desired lines - + + #iterate over chapters my $j = 0; my @page_text; + foreach (@chapters) { my @chapter_lines = split(/\r\n/, $chapters[$j]);