diff options
| author | Ahmed <git@gumx.cc> | 2026-06-19 20:52:59 +0300 |
|---|---|---|
| committer | Ahmed <git@gumx.cc> | 2026-06-19 20:52:59 +0300 |
| commit | 2d2ea063ac71ec648e71f85ba0cdfc599f94473f (patch) | |
| tree | ccc59b4138400a21e92eaf65132a4090a0202707 /_shared/build.py | |
| parent | f9342916a7fcc6fca16fe4619afe4e8ec6db584c (diff) | |
fix: style
Diffstat (limited to '_shared/build.py')
| -rw-r--r-- | _shared/build.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/_shared/build.py b/_shared/build.py index a12cd73..a3bd09d 100644 --- a/_shared/build.py +++ b/_shared/build.py @@ -4,8 +4,12 @@ import json import os import sys -def render(title, breadcrumb, style, extra_css, body, footer): +def render(title, breadcrumb, style, extra_css, body, footer, standalone=False): css = style + ("\n" + extra_css if extra_css.strip() else "") + if standalone: + nav = f"<nav><strong>{breadcrumb}</strong></nav>" + else: + nav = f'<nav><strong><a href="https://gumx.cc">gumx</a></strong> / {breadcrumb}</nav>' return f"""<!DOCTYPE html> <html lang="en"> <head> @@ -19,7 +23,7 @@ def render(title, breadcrumb, style, extra_css, body, footer): </head> <body> <header> -<nav><strong><a href="https://gumx.cc">gumx</a></strong> / {breadcrumb}</nav> +{nav} </header> <main> <h1>{breadcrumb}</h1> @@ -68,6 +72,7 @@ def build(sites_dir): title = site breadcrumb = site + standalone = False meta_file = os.path.join(site_dir, "meta") if os.path.exists(meta_file): for line in open(meta_file): @@ -76,13 +81,15 @@ def build(sites_dir): title = v.strip('"') elif k == "BREADCRUMB": breadcrumb = v.strip('"') + elif k == "STANDALONE": + standalone = v.strip().strip('"') not in ("0", "false", "") extra_css = "" extra_file = os.path.join(site_dir, "extra.css") if os.path.exists(extra_file): extra_css = open(extra_file).read() - out = render(title, breadcrumb, style, extra_css, body, footer) + out = render(title, breadcrumb, style, extra_css, body, footer, standalone=standalone) with open(os.path.join(site_dir, "index.html"), "w") as f: f.write(out) print(f"built: {site}") |
