import htmlmin, pathlib

path = str(pathlib.Path(__file__).parent.absolute()) + "/"

pages = {
    "manage.html": "html_config",
    "root.html": "html_root",
    "style.css": "html_css",
}

out_files = "c++/"
in_files = "html/"

for page in pages:
    with open(path+out_files+pages[page]+".h", "w+", encoding="utf-8") as f_result:
        f_result.write("// Auto-generated by html2cpp\n// (c) Vladislav Kalugin, 2020\n\n#include <string.h>\n\n")


        print("Generating " + pages[page])

        with open(path+in_files+page, "r", encoding="utf-8") as f:
            page_min = htmlmin.minify(f.read())

            page_min = page_min.replace("\"", "\\\"")

            f_result.write("String " + pages[page] + " = \"" + page_min + "\";\n\n")

f_result.close()

