diff --git a/zooms_generator.py b/zooms_generator.py index d075a87..a3baf88 100644 --- a/zooms_generator.py +++ b/zooms_generator.py @@ -10,45 +10,8 @@ import argparse from pathlib import Path -HTML_START_CONSTANT = """\ - - -
-
-""" - -HTML_END_CONSTANT = """\ -
-
-
-
-
-
-
-
-
-
-
-
/ scroll up / clic : previous
-
/ scroll down / clic : next
-
-----------------------
-
F
: Toggle fullscreen
-
P
: Toggle progress bar
-
V
: Toggle panel / page viewing mode
-
-
- -
-
-
-
-
-
- -""" +HTML_TEMPLATE = Path(__file__).parent / "melpomene.html" +HTML_TO_REPLACE = "" def extract_zooms(src_folder): @@ -115,21 +78,21 @@ def write_json_or_js(zooms, dest_file, is_js): def write_html(zooms, dest_file, pages_width, pages_height, prefix, extention): - with open(dest_file, "w") as data_file: + img_tags = "" + for page_idx in sorted(zooms.keys()): + img_url = f"{prefix}{zooms[page_idx]['name']}.{extention}" + zoom_html_data = [','.join([str(zoom) for zoom in page_zooms]) for page_zooms in zooms[page_idx]["zooms"]] + zoom_html_str = ';'.join(zoom_html_data) + img_tags = img_tags + f' \n' - data_file.write(HTML_START_CONSTANT) + img_tags = img_tags.strip() - data_file.write(f' \n') - - data_file.write(HTML_END_CONSTANT) + data = template_file.read().replace(HTML_TO_REPLACE, img_tags) + + data_file.write(data) + def generate_argparse(): """ Generate Melpomene's generator input parser"""