From c5f14fb9b876477b6912b51c8c8a69653cc83d89 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Wed, 15 Mar 2023 14:19:28 -0300 Subject: [PATCH] Optimize the HTML generation speed --- modules/html_generator.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index c8579f8100..9942e6c948 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -14,12 +14,16 @@ # 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'