diff --git a/modules/html_generator.py b/modules/html_generator.py index c8579f81..9942e6c9 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -14,12 +14,16 @@ from PIL import Image # This is to store the paths to the thumbnails of the profile pictures image_cache = {} -def generate_basic_html(s): - with open(Path(__file__).resolve().parent / '../css/html_readable_style.css', 'r') as f: - css = f.read() +with open(Path(__file__).resolve().parent / '../css/html_readable_style.css', 'r') as f: + readable_css = f.read() +with open(Path(__file__).resolve().parent / '../css/html_4chan_style.css', 'r') as css_f: + _4chan_css = css_f.read() +with open(Path(__file__).resolve().parent / '../css/html_cai_style.css', 'r') as f: + cai_css = f.read() +def generate_basic_html(s): s = '\n'.join([f'

{line}

' for line in s.split('\n')]) - s = f'
{s}
' + s = f'
{s}
' return s def process_post(post, c): @@ -37,9 +41,6 @@ def process_post(post, c): return src def generate_4chan_html(f): - with open(Path(__file__).resolve().parent / '../css/html_4chan_style.css', 'r') as css_f: - css = css_f.read() - posts = [] post = '' c = -2 @@ -66,7 +67,7 @@ def generate_4chan_html(f): posts[i] = f'
{posts[i]}
\n' output = '' - output += f'
' + output += f'
' for post in posts: output += post output += '
' @@ -101,10 +102,7 @@ def load_html_image(paths): return '' def generate_chat_html(history, name1, name2, character): - with open(Path(__file__).resolve().parent / '../css/html_cai_style.css', 'r') as f: - css = f.read() - - output = f'
' + output = f'
' img_bot = load_html_image([f"characters/{character}.{ext}" for ext in ['png', 'jpg', 'jpeg']] + ["img_bot.png","img_bot.jpg","img_bot.jpeg"]) img_me = load_html_image(["img_me.png", "img_me.jpg", "img_me.jpeg"])