if __name__ == "__main__": rows = [0.01, 0.02, 0.05, 0.10] cols = [0.0, 0.001, 0.002, 0.01] filenames = [["g{:.6f}_k{:.6f}.html".format(g_value, k_value) for k_value in rows] for g_value in cols] print(filenames) a = Airium() a('<!DOCTYPE html>') with a.html(lang="en"): with a.head(): a.meta(charset="utf-8") a.title(_t="Index") a.style(_t=CSS_STRING()) # a.script(type="text/javascript", src="index.js") with a.body(): a.h2(_t="Index") with a.table(id='table_372'): with a.tr(): pivot_str = "k \\ g" a.td(_t=pivot_str) for y in cols: column_label = "{:3}".format(y) a.td(_t=column_label) for i, x in enumerate(rows): with a.tr():
def create_index_page(out_dir: str, out_name: str, gen_files: List[str]) -> None: """ Generates index page. """ template = Airium() logging.info("Generating: %s", out_name) with template.html(): with template.head(): template.title(_t="Enso Reference") template.link(href="style.css", rel="stylesheet") template.link(href="favicon.ico", rel="icon") template.style(_t="ul { padding-inline-start: 15px; }") template.style( _t="""ul, .section ul { list-style: none; padding: 0; margin: 0; word-wrap: initial; } ul li { padding: 5px 10px; } .section ul { display: none; } .section input:checked ~ ul { display: block; } .section input[type=checkbox] { display: none; } .section { position: relative; padding-left: 20px !important; } .section label:after { content: "+"; position: absolute; top: 0; left: 0; padding: 0; text-align: center; font-size: 17px; color: cornflowerblue; transition: all 0.3s; } .section input:checked ~ label:after { color: cadetblue; transform: rotate(45deg); } @media only screen and (max-width: 1100px) { #tree { width: 30% !important; } } """ ) template.script( _t="""function set_frame_content(file) { document.getElementById("frame").src = file }""" ) with template.body(style="background-color: #333"): template.h2( style="""text-align: center; padding: 15px; margin: 0; color: #fafafa""", _t="Enso Reference", ) with template.div( style="background-color: #fafafa; display: flex; height: 100%" ): with template.div( id="tree", style="""background-color: #efefef; border-radius: 14px; width: 20%; margin: 15px; padding-left: 20px; overflow: scroll; height: 90%;""", ): grouped_file_names = group_by_prefix(gen_files) create_html_tree(template, "", grouped_file_names, gen_files) template.iframe( frameborder="0", height="100%", id="frame", src="Base-Main.html", width="100%", target="_blank", ) html_file = open(out_dir + "/" + out_name, "w") html_file.write(str(template)) html_file.close()