telzine/dialazine/generate_html.py

24 lines
866 B
Python
Raw Normal View History

2023-07-30 03:26:31 +00:00
#!/usr/bin/python3
import os
import argparse
from pathlib import Path
from lib.html_generator import HtmlGenerator
TEMPLATES = "default_templates"
CONTENT_FOLDER = "example_issue"
parser = argparse.ArgumentParser(description="Use this tool to export html documents for your zine")
parser.add_argument("outputdir", type=Path, help="output directory for generated HTML")
args = parser.parse_args()
if not args.outputdir:
raise ValueError("Required param outputdir missing, run program with -h")
html_directory = args.outputdir.as_posix()
root_dir_path = Path(__file__).parent.parent.absolute()
index_directory = "%s/%s" % (root_dir_path.as_posix(), f"{CONTENT_FOLDER}/index.json")
templates_directory = "%s/%s" % (root_dir_path.as_posix(), TEMPLATES)
generator = HtmlGenerator(index_directory, html_directory, templates_directory)
generator.write_zine_html()