from typing import Union def make_html_start(title: Union[str, None] = None): style = """ * { box-sizing: border-box; } body { margin-left: 2rem; } header { padding-top: 0.5rem; height: 5rem; } .sample { font-family: sans-serif; font-weight: 500; font-size: 1.2rem; width: max(60vw, 60rem); border-bottom: 2px solid #aaa; padding: 0.5rem 0 0.5rem 0; } .audio-wrapper { display: flex; align-items: center; justify-content: space-between; width: 60rem; flex-wrap: wrap; } .audio-wrapper label { display: inline-block; width: 3.5rem; } .audio-row { display: flex; align-items: center; } audio { height: 2rem; width: 22rem; margin-right: 1rem; } .text-arabic { font-size: 1.6rem; margin: 0.5rem; } .row-title { width: 6rem; } """ title = f"{title}" if title is not None else "" html = f""" Samples {title} """ return html def make_html_end(): html = """ """ return html def make_sample_entry(wav_path: str, text: str): text = text.replace('<', '<').replace('>', '>') html = f"""

{text}
""" return html def make_sample_entry2(wav_path: str, text0: str, text1: str, ar_dir: str = 'ltr'): text0 = text0.replace('<', '<').replace('>', '>') text1 = text1.replace('<', '<').replace('>', '>') html = f"""
{text0}
{text1}
""" return html def make_double_entry(wav_gen: str, wav_ref: str, text0: str, text1: str, ar_dir: str = 'ltr'): text0 = text0.replace('<', '<').replace('>', '>') text1 = text1.replace('<', '<').replace('>', '>') html = f"""
{text0}
{text1}
""" return html def make_multi_entry(wavs_list, row_titles, text0: str, text1: str, ar_dir: str='ltr'): text0 = text0.replace('<', '<').replace('>', '>') text1 = text1.replace('<', '<').replace('>', '>') rows = "" for i in range(0,len(wavs_list),2): row_title = row_titles[i//2] rows += f"""
{row_title}
""" html = f"""
{rows}
{text0}
{text1}
""" return html def make_h_tag(text: str, n: int = 2): html = f"""{text} """ return html def make_img_tag(src: str, alt: str = ""): html = f"""{alt} """ return html def make_volume_script(volume: float = 0.35): html = f""" """ return html